for and while loops

Bayazee bayazee at gmail.com
Thu Jun 29 00:19:15 CEST 2006


hi

#Exercise 1 :
s=0
while 1:
  s+=input("Enter a num : ")
  if s>=100:
    print "The sum is greater than 100 : ",s
    break

#Exercise 1 :
s=0
for i in range(5):
  s+=input("Enter num #%d > "%(i+1))
print "The Sum is : " , s




More information about the Python-list mailing list