My problem is really frustrating. I'm learning Python right now and can't find a solution for my problem. This is only an example for different outputs. not a code with usage.
here's my Code:
text_2 = input("Input number or text: ")
if text_2 == --number-- :
print("Your number is: ")
elif text_2 == --text aka string-- :
print("Your text is: ")
else:
print("Wrong_Input_1")
How can I do, that python recognizes the difference between a number and a string aka letters. my first problem was with
if text_2 == str(input) :
print("Your IP is: ")
Python interprets even int's as string
my second problem: I don't know how Python only takes int as input. My thought was:
if text_2 == int(input) :
print("Your IP is: ")
But that's not working.
the last problem is:
I want something similar to ´goto´. I know it's different in Python and not recommended to do it. so I need something different. In the following code I will show how it should be like
first_stage
text_2 = input("Which stage will you go?: ")
if text_2 == "go to second stage" :
print("going to second stage")
goto second_stage
elif text_2 == "go to third stage" :
print("going to third stage")
goto third_stage
elif text_2 == "go to first stage" :
print("going to first stage")
goto first_stage
second_stage
text_3 = input("Which stage will you go?: ")
if text_3 == "go to first stage" :
print("going to first stage")
goto first_stage
elif text_3 == "go to second stage" :
print("going to second stage")
goto second_stage
elif text_3 == "go to third stage" :
print("going to third stage")
goto third_stage
third_stage
text_4 = input("Which stage will you go?: ")
if text_4 == "go to third stage" :
print("going to third stage")
goto third_stage
elif text_4 == "go to first stage" :
print("going to first stage")
goto first_stage
elif text_4 == "go to second stage" :
print("going to second stage")
goto second_stage
Would be nice if you can give me the alternative code for my last problem right in my code.
Last question: which command do I need to clear the output-window?