there are two mistakes you need to fix.
- change
while set1 != 1 or set1 != 2:
to while set1 != 1 and set1 != 2:
otherwise it will never stop.
- change
set1 == int(input("Please enter your choice:"))
to set1 = int(input("Please enter your choice:"))
now everything is Ok. final code must look like this:
elif menu == 3:
set1 = 3
print("1.Restart the program automatically")
print("2.Restart the program manually")
while set1 != 1 and set1 != 2:
set1 = int(input("Please enter your choice:"))
if set1 == 1:
print("Set 1 works")
elif set1 == 2:
print("Set 2 works")
else:
print("Smash the monitor")
print("Goes to the main body")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…