I have an assignment that states...
Create a condition looop that will ask the user for input of two numbers. The numbers should be added and the sum displayed. The loop should also ask the user if he or she wishes to perform the operation again. If so, the loop should repeat, otherwise the loop should terminate.
This is what I have come up with...
n1=input('Please enter your first number: ')
print "You have entered the number ",n1,""
n2=input('Pleae enter your second number: ')
print "You have entered the number ",n2,""
total=n1+n2
print "I will now add your numbers together."
print "The result is:",total
y = raw_input('Would you like to run the program again? y=yes n=no')
print'The program will now terminate.'
y='y'
while y=='y':
print 'The program will start over.'
When you run this the first part of the program will work but when it ask you to run again it will continuously state "The program will start over."
How do I allow for the user to input wether or not they would like to start the program over and how do I word this so that it will loop?