+ 1

How can I call up functions in if or else?

Let's say my code is Way = input ("Do you want run or stay?") if Way == "Run": Run() else: Way == "Stay" Stay() Run(): Print("Running Fast") Stay(): Print("Staying quite") how can I get the code to run without printing both statements??

8th Jun 2020, 8:28 PM
Alan Matt Cortez
Alan Matt Cortez - avatar
2 Answers
+ 5
def Run(): print("running fast") def Stay(): print("Staying quite") way=input() If way=="Run": Run() elif way=="Stay": Stay()
8th Jun 2020, 8:34 PM
Abhay
Abhay - avatar
+ 1
Thanks Abhay thank you so much I'll give that a try!!
8th Jun 2020, 8:36 PM
Alan Matt Cortez
Alan Matt Cortez - avatar