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 @GavinKoeng:

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

111 active golfers, 348 entries

Solutions by @GavinKoeng:
42
#20 - Gavin / @GavinKoeng

07/10/2026 at 06:12AM

43
#>27 - Gavin / @GavinKoeng

07/10/2026 at 06:11AM

44
#>29 - Gavin / @GavinKoeng

07/10/2026 at 06:11AM

45
#>30 - Gavin / @GavinKoeng

07/10/2026 at 06:10AM

46
#>31 - Gavin / @GavinKoeng

07/10/2026 at 06:10AM

47
#>35 - Gavin / @GavinKoeng

07/10/2026 at 06:09AM

48
#>38 - Gavin / @GavinKoeng

07/10/2026 at 06:05AM

48
#>38 - Gavin / @GavinKoeng

07/10/2026 at 06:07AM

49
#>40 - Gavin / @GavinKoeng

07/10/2026 at 06:01AM

49
#>40 - Gavin / @GavinKoeng

07/10/2026 at 06:04AM

50
#>43 - Gavin / @GavinKoeng

07/10/2026 at 06:01AM

52
#>53 - Gavin / @GavinKoeng

07/10/2026 at 05:58AM

71
#>101 - Gavin / @GavinKoeng

07/10/2026 at 05:55AM

73
#>104 - Gavin / @GavinKoeng

07/10/2026 at 05:57AM