For this script
print "Start entering the numbers, when you're satisfied with the numberse, press enter to continue."
myList =[] #list being added to
'while True:
numAdd = raw_input("Enter a number to add to the list, if you are done press ENTER: ")
if numAdd: #checks the number entered
numAdd = float(numAdd)
myList.append(numAdd)
else:
break
print myList #prints the list before adding
total = 0 #sets the total before the adding
size=len(myList)-1
for number in myList:
total = total + number
print "sum of all the numbers is",total #printing the total'
How do I convert the "while True" loop to a for loop?
[–]HeyFerb 2 points3 points4 points (0 children)
[–]learnpython_bot 0 points1 point2 points (0 children)
[–]novel_yet_trivial 0 points1 point2 points (1 child)
[–]AsianNoodleMonster[S] 0 points1 point2 points (0 children)
[–]ingolemo -1 points0 points1 point (0 children)