print("what type of device do you have phone, tablet or laptop?")
device = input ("phone/tablet/laptop:")
为什么一旦接听电话,它就不会出现电话问题?
def phone():
print("Do you have an iphone or samsung?")
phone = input ('iphone/samsung:')
if phone == "iphone":
print("which type of iphone do you have?")
phone = input ("iphone:")
if phone == "samsung":
print("which type of samsung do you have?")
phone = input ("samsung type:")
为什么一旦接听电话,它就不会出现在平板电脑上?
def tablet():
print("What type of tablet do you have?")
tablet = input ("android tablet or ipad:")
一旦你接听电话,为什么不回到笔记本电脑的问题?
def laptop():
print("What type of laptop do you have?")
laptop = input ("windows/ios:")
答案 0 :(得分:1)
您必须评估他们输入的内容是手机,平板电脑还是笔记本电脑。您可以使用if语句。如果他们输入“手机”,请拨打电话功能。
print("What type of device do you have? Phone, Tablet or a Laptop?")
device = input("phone/tablet/laptop: ")
if device == 'phone':
phone()
elif device == 'tablet':
tablet()
elif device == 'laptop':
laptop()