python 3.9 magic number code example
Example: python magic number
MagicNumber = []
confirmation = "Confirm"
Cancel = "Cancel"
for n in range(5):
try:
user = int(input("Please Enter your Magic number: "))
MagicNumber.append(user)
if True:
print(f"The value you enter was : {user}")
UserConfirm = input(" Enter Confirm to Continue or cancel to Cancel: ")
if UserConfirm == confirmation:
continue
elif UserConfirm == Cancel:
break
else:
print("------------------------------------------")
print("Not a correct input, Please try again!!!")
print("------------------------------------------")
if True:
print("The Number you enter was : ", user)
UserConfirm = input(" Enter Confirm to Continue or cancel to Cancel: ")
if UserConfirm == confirmation:
continue
elif UserConfirm == Cancel:
break
except ValueError:
print("wrong type of number, Prefer integer")
print("Your Magic Number are: ", MagicNumber)