Skip to content
HELP PLEASE : how do I use the return function?
Profile icon
ElvisNguyen

can someone please help me out. How do i return it back to " A = int(input("Please Enter A Numerical Length For the Triangle: A = "))" . I have no clues on how to do it. Could some expert help me out please!!

You are viewing a single comment. View All
Answered by ash15khng [earned 5 cycles]
View Answer
Profile icon
RyanRana

I did it using the strip of code.

name = input("What is your name? \n") #asking the user their name
print("Welcome, " + name + "!") #print the message with customer name
print("Let plays the triangle guesing game") #welcome messages
is_number = False
while is_number == False:
A = input("Please Enter A Numerical Length For the Triangle: A = ")

for i in A:
if i in ["0","1","2","3","4","5","6","7","8","9"]:
is_number = True

else: print("That is not an Numerical, Please ONLY ENTER NUMERICAL") break

I kept the input in a loop and checked if it was an int in the loop if so then it breaks the loop.