创建一个atm程序效果很好,但是我的问题是,如果用户按enter键或任何字母会使该程序崩溃。
如果选项!= int(输入,则尝试使用ord(),chr()。
if deposit_withdrawal_mode == False:
option = int(input())
elif transfer_funds_mode == False:
option = int(input())
if option == 6:
pin_error = True
print("Exited Program")
break
elif option < 1:
print("***Invalid Entry***")
elif option > 6:
print("***Invalid Entry***")
expected output when user enters anything but an integer thats valid for
the options: Invalid entry
Actual output: invalid literal for int() with base 10