Begginers Guide - Exrcise. Help me, plz!

Sheila King usenet at thinkspot.net
Sat Mar 16 16:10:52 EST 2002


On Sat, 16 Mar 2002 23:45:30 +0300, "Jeffrey-man" <i-have at no.mail> wrote in
comp.lang.python in article <a70at9$2mec$1 at gavrilo.mtu.ru>:

> 
> sum_stop = 100
> num = input("Please enter the number: ")
> 
> for sum in range(num+num,sum_stop):
>     print "Now the sum is", num+num
>     sleep(1)
> 
> print "The sum is >/= 100!"


You need some type of loop. Also, you need to initialize your sum.

sum_stop = 100
sum = 0

while (sum < sum_stop):
    < your code for getting the input >
    < and incrementing the sum >
    < goes here >

print "The sum is ", sum


HTH,

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/



More information about the Python-list mailing list