I started learning python 3 days ago and needed some help on my code...
#Basic calculator
#First python calculator
#How to improve this???
name = str(input("Hello please enter in your name: "))
print("Nice meeting you " + name)
print("This is a very basic calculator that i've made. Hope you enjoy!")
def calculator():
choose = str(input("ADDITION(a), MULTIPLICATION(m), SUBTRACTION(s), DIVISION(d) "))
if choose == 'a':
number1 = int(input("Choose your first number: "))
number2 = int(input("Choose your second number: "))
print(number1 + number2)
elif choose == 's':
number1 = int(input("Choose your first number: "))
number2 = int(input("Choose your second number: "))
print(number1 - number2)
elif choose == 'm':
number1 = int(input("Choose your first number: "))
number2 = int(input("Choose your second number: "))
print(number1 * number2)
elif choose == 'd':
number1 = int(input("Choose your first number: "))
number2 = int(input("Choose your second number: "))
print(number1 / number2)
calculator()
go_again = str(input("Would you like to go again? Y/N "))
if go_again == 'y':
calculator() #How to loop this???
elif go_again == 'n':
print("Goodbye...")
exit()i want to loop the "go_again" var to where it keeps running until the user enters "no", because right now it only runs once. My guess is that it needs a while loop, but how would i do that?User has been warned for this post. Reason: bad title description
