一、ide
>>> tag = True >>> while tag: a = input("please input something : ") if a == "quit": tag = False else: print(a) please input something : 100 100 please input something : abc abc please input something : quit
二、ui
>>> tag = True >>> while tag: a = input("please input something:") b = int(input("please input an num: ")) if a == "quit": tag = False else: print(a) if b % 2 == 0: tag = False else: print(b) please input something:abc please input an num: 15 abc 15 please input something:quit please input an num: 15 15