Hi Guys,
I'm a beginner programming with Python. This is my first program. The purpose of this program is to add two numbers and then give me the result. However, after that I want for it to ask me if I want to continue (y) or (n). I came with some difficulties and every change I make it gives me an error message. This is what I have so far.
print "Let's learn how to add"
x = int(input ("Give me the first number: "))
y = int(input ("Give me the second number: "))
print "The result is", (x+y)
userinput = input('Want to continue adding?\nA) Y\nB) N\n').lower()
if userinput == 'a':
print " Let's continue learning how to add"
x = int(input ("Give me the first number: "))
y = int(input ("Give me the second number: "))
print "The result is", (x+y)
if userinput == 'b':
print ('\nNow quitting program..')
time.sleep(3)
else:
print('\nPlease enter "A", or "B"\n')
I really appreciate your feedback. Will comment on threads once I understand what I'm doing. :) Thanks.