I’m trying to make this code go back to the top of the program instead of ending at the printed string after the first if statement.
num_1 = (input("Please enter a whole number: "))
num_2 = (input("Please enter a second whole number: "))
if num_1.find (".") != -1 or num_2.find(".")!= -1:
print("sorry enter a whole number"):
else:
print("numbers are whole perform the calculation")
num_1 = int(num_1)
num_2 = int(num_2)
print(f"{num_1} + {num_2} = {num_1 + num_2} ")
I have tried everything I can think of, but I’m new to this so any help would be appreciated.
New contributor
Peter Whitehead is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.