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

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 95 remaining solutions by signing in and submitting your own entry
#96 David Burns / @AutomatedTester - Score: 146 - 01/28/11 @ 15:17
itmp = []<CR><Esc><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>v<Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>x<Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>pu<Left>o<Up><CR><Up><Esc>pi<Right>:<Down><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><CR><Up><Tab><BS>    tmp.append(<Esc><Down><Right>v<Right><Right><Right>x<Up>pi<Right>)<Down><BS><BS><BS>tmp<Esc><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>dw<Down>dd:wq<CR>

0 comments


Created by: @vimgolfer

96 active golfers, 247 entries

Leaderboard (lowest score wins):
57
#61 - Richard Davison / @richarddavison

07/14/2017 at 05:28PM

58
#62 - James Cash / @jamesnvc

01/28/2011 at 03:45PM

58
#63 - Alekseyka2 / @Alekseyka2

01/28/2011 at 10:30PM

58
#64 - Mark Smith-Guerrero / @msmithgu

02/01/2011 at 06:06PM

58
#65 - Alex Hammel / @AlexJHammel

12/23/2012 at 03:05PM

59
#66 - Rob Ciaccio / @RobertoCalavera

01/28/2011 at 06:16PM

59
#67 - Daniel / @dpaneda

09/26/2011 at 10:47PM

59
#68 - banana / @sparkleseed

03/13/2012 at 03:37PM

59
#69 - Munzor / @t3hmun

04/28/2014 at 06:38PM

60
#70 - Michael Perrone / @ThePerrone

12/22/2013 at 03:28AM

60
#71 - Daniel Jonsson / @DanielJonss

01/21/2014 at 04:47PM

60
#72 - かしゅーなっつ@修行中 / @kashew_nuts

08/02/2014 at 08:38AM

62
#73 - Rörd Hinrichsen / @roerdhh

01/29/2011 at 03:03AM

62
#74 - Nomen Nescio / @vadtusan

04/14/2011 at 08:03AM

63
#75 - Federico Bond / @federicobond

09/22/2012 at 11:15PM

63
#76 - Gurukandhamoorthi / @Gurukandhamoor1

09/02/2017 at 05:03PM

64
#77 - Burkhard Zimmermann / @BurkZimm

12/26/2011 at 11:35PM

65
#78 - Steven Occhipinti / @steveocchipinti

02/03/2011 at 03:27AM

65
#79 - Dj Vimgolf / @dj_vimgolf

12/31/2011 at 01:16AM

66
#80 - Matthieu Honel / @ocus

01/28/2011 at 03:31PM

67
#81 - Helder Inacio / @inaciohj

02/03/2011 at 03:32AM

67
#82 - Torben Rasmussen / @rasmustorben

08/16/2011 at 04:34PM

69
#83 - Dmitry Teslenko / @krab_mozga

02/02/2011 at 09:43AM

69
#84 - Patrice Clement / @patrice_clement

03/18/2014 at 08:32PM

70
#85 - Jon Bettinger / @jonbettinger

01/31/2011 at 02:35AM

70
#86 - stefan otte / @stefanotte

01/30/2012 at 01:39PM

70
#87 - Arto Vuori / @dhpe

09/01/2012 at 04:50PM

72
#88 - Vernon Thommeret / @synotic

01/30/2011 at 03:38PM

72
#89 - Christopher Brew / @Seph1rothVII

01/11/2012 at 12:41AM

73
#90 - Pavlo Klets / @p01nt

01/28/2011 at 03:27PM