[Tutor] small program
bgailer at gmail.com
Fri Oct 2 17:38:35 CEST 2009
> There are interesting online course
> 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. "
> print d+y
> How to create a program for such kind of task?
Pardon my skepticism - I'm guessing you are taking the course and this
is homework. We prefer not to do your homework for you. If it is not
homework - we prefer not to write programs for you.
Unfortunately Benno gave you a solution.
If you want to learn Python read on:
In regard to the above code - did you try to run it? That is step one.
Try to run it. See if you can figure out why it fails. Hint there are 2
At python.org there are links to several tutorials which will show you
how to repeat operations.
To repeat things in Python we can use a loop. What Python statements are
used for loops?
Chapel Hill NC
More information about the Tutor