继承我的代码:
def start():
print("Hello world!")
name=input("Please enter your name: ")
print("Hi {0}".format(name))
run=input("type | True | to run the program: ").capitalize()
if run== "True":
running = True
else:
print("You need to enter | True | to run the program")
def main():
if running== True:
print("1 = Add")
print("2 = Subtract")
print("3 = Times")
print("4 = Divide")
print("5 = Quit program")
calc=int(input("enter number of choise: "))
答案 0 :(得分:1)
您永远不会调用任何一项功能,您需要调用其中一项功能来启动您的程序,以获得所需的功能,您需要调用start()
然后,如果用户输入True
def start():
print("Hello world!")
name=input("Please enter your name: ")
print("Hi {0}".format(name))
run=input("type | True | to run the program: ").capitalize()
if run== "True":
main() #the user typed true, so lets jump to your main function
else:
print("You need to enter | True | to run the program")
def main():
print("1 = Add")
print("2 = Subtract")
print("3 = Times")
print("4 = Divide")
print("5 = Quit program")
calc=int(input("enter number of choise: "))
start() #the program never runs your start function without this line