Python 需要帮助才能成为信用持有人吗?
我正在用python制作自动售货机,但遇到了一个障碍。我做这项工作是作为一个受控的评估,我必须遵循一些准则,比如自动售货机应该有一个信用持有人来告诉你你有多少钱。我的问题是它没有记录超过0.99英镑的数字。我希望有人能指出我犯的错误,或者给我一点帮助Python 需要帮助才能成为信用持有人吗?,python,Python,我正在用python制作自动售货机,但遇到了一个障碍。我做这项工作是作为一个受控的评估,我必须遵循一些准则,比如自动售货机应该有一个信用持有人来告诉你你有多少钱。我的问题是它没有记录超过0.99英镑的数字。我希望有人能指出我犯的错误,或者给我一点帮助 angel= float(0.00) repeat = True while repeat==True: choice=int(input("""Please select how much you would like to enter
angel= float(0.00)
repeat = True
while repeat==True:
choice=int(input("""Please select how much you would like to enter
1.10p
2.20p
3.50p
4.£1 """))
if choice==1:
angel=(angel + 0.10)
if choice==2:
angel=(angel + 0.20)
if choice==3:
angel=(angel + 0.50)
if angel==4:
angel=(angel + 1.00)
choice2=str(input("Would you like to input more money to your ballance? y/n"))
if choice2== "y":
repeat= True
else:
repeat= False
print("Your balance currently stands at £",angel)
store=int(input("""Please select what you would like to buy
1. Pleb bar £2
2. Geb bar £0.10
3. Plebsi £1
4. Goke £0.50
5. Jeb bar £1.50 : """))
这就是我目前所拥有的;这很简单,但我需要确保这个信用钱包工作正常。感谢您的帮助,非常感谢。如果:
if angel==4:
angel=(angel + 1.00)
取而代之的是:
if choice==4:
angel=(angel + 1.00)
还有这样的指导方针吗?好吧,我真是太蠢了,我从来没有说过,非常感谢