Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 4d42cde1e6dc010cb7000024

expand a list comprehension (python)

Please show your way to convert a list comprehension in python to an ordinary for-loop expression!

Start file
print [x**2 for x in xrange(10)]
End file
tmp = []
for x in xrange(10):
    tmp.append(x**2)
print tmp

View Diff

1c1,4
< print [x**2 for x in xrange(10)]
---
> tmp = []
> for x in xrange(10):
>     tmp.append(x**2)
> print tmp

Solutions by @nickandbro:

Unlock 30 remaining solutions by signing in and submitting your own entry
Created by: @vimgolfer

109 active golfers, 333 entries

Solutions by @nickandbro:
42
#19 - nickGPT / @nickandbro

08/28/2024 at 11:02PM

43
#>26 - nickGPT / @nickandbro

08/28/2024 at 11:02PM

44
#>28 - nickGPT / @nickandbro

08/28/2024 at 11:02PM

45
#>29 - nickGPT / @nickandbro

08/28/2024 at 11:02PM

46
#>30 - nickGPT / @nickandbro

08/28/2024 at 11:02PM

47
#>34 - nickGPT / @nickandbro

08/28/2024 at 11:02PM

48
#>37 - nickGPT / @nickandbro

08/28/2024 at 11:01PM

49
#>39 - nickGPT / @nickandbro

08/28/2024 at 11:01PM

50
#>42 - nickGPT / @nickandbro

08/28/2024 at 11:01PM

51
#>47 - nickGPT / @nickandbro

08/28/2024 at 11:01PM

52
#>52 - nickGPT / @nickandbro

08/28/2024 at 11:01PM

53
#>55 - nickGPT / @nickandbro

08/28/2024 at 11:01PM

54
#>59 - nickGPT / @nickandbro

08/28/2024 at 11:01PM

55
#>63 - nickGPT / @nickandbro

08/28/2024 at 11:01PM

56
#>68 - nickGPT / @nickandbro

08/28/2024 at 11:00PM

57
#>71 - nickGPT / @nickandbro

08/28/2024 at 11:00PM

58
#>75 - nickGPT / @nickandbro

08/28/2024 at 11:00PM

59
#>79 - nickGPT / @nickandbro

08/28/2024 at 10:59PM

60
#>82 - nickGPT / @nickandbro

08/28/2024 at 10:59PM

61
#>82 - nickGPT / @nickandbro

08/28/2024 at 10:59PM

64
#>88 - nickGPT / @nickandbro

08/28/2024 at 10:59PM

65
#>91 - nickGPT / @nickandbro

08/28/2024 at 10:59PM

66
#>92 - nickGPT / @nickandbro

08/28/2024 at 10:59PM

67
#>94 - nickGPT / @nickandbro

08/28/2024 at 10:59PM

69
#>96 - nickGPT / @nickandbro

08/28/2024 at 10:59PM

70
#>99 - nickGPT / @nickandbro

08/28/2024 at 10:59PM

72
#>101 - nickGPT / @nickandbro

08/28/2024 at 10:58PM

73
#>102 - nickGPT / @nickandbro

08/28/2024 at 10:58PM

75
#>104 - nickGPT / @nickandbro

08/28/2024 at 10:58PM

78
#>105 - nickGPT / @nickandbro

08/28/2024 at 10:58PM