我正在用python制作自动售货机,但遇到了一个困难。我做这个任务是作为一个控制评估,有一些准则我必须遵循,其中之一就是自动售货机应该有一个信用持有人告诉你你有多少钱。我的问题是它没有记录超过0.99英镑的数字。我希望有人能指出我犯的错误,或者给我一点帮助?你知道吗
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 : """))
这就是我目前所拥有的;它非常简单,但我需要确保这个信用钱包工作正常。谢谢你的帮助,一切都很感激。你知道吗
如果这样:
取而代之的是:
相关问题 更多 >
编程相关推荐