[Tutor] small program

Benno Lang transmogribenno at gmail.com
Fri Oct 2 10:29:14 CEST 2009


On Thu, Oct 1, 2009 at 8:31 PM, Andrius <ziniatinklis at gmail.com> wrote:
> Hi!
>
> There are interesting online course
> http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-00Fall-2008/LectureVideos/index.htm
> where I'm trying to learn Python.
> Looks quite interesting and I would like to create a program which
> should repeat a simply string several times with list number before.
> Like "1. Wanna more. 2. Wanna more. ..."
> Suppose to a loop here repeating, say x times. Should it look like that:
>
> y="Wanna more. "
> x=1
> x=x+d:
> d=<100
> print d+y
>
> How to create a program for such kind of task?

[Forgot to reply-all the first time:]

Something like this should do the trick, if I get what you're trying to do:

x = 10
for i in range (1, x + 1):
   print i, "whee"

HTH,
benno


More information about the Tutor mailing list