+ 1
Could somebody explain why does the result look like this, i knew the mistake of this code,but i dont know why it print like dis
money = 5000 print("money: ",money) b = str(input("input: ")) print(b) print("-coffee 2000\n-gundam 10000 \n") if b=="coffee" or "Coffee": money-=2000 if money<0: print("you dont have enough money") else: print("your money: ",money) elif b=="gundam" or "Gundam": money-=10000 if money<0: print("you dont have enough money") else: print("your money: ",money) else: print("error") Result: money: 5000 input: gundam(i tried to input the other string) -coffee 2000 -gundam 10000 your money: 3000
3 ответов
+ 7
I am not sure , but at that :
if b=='coffee' or "Coffee"
Should be:
If b=="coffee" or b=="Coffee"
Same at that elif.
0
Yeah,i knew but why does the result look like that