+ 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

20th May 2019, 12:53 PM
ENDERllama 15
ENDERllama 15 - avatar
3 odpowiedzi
+ 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.
20th May 2019, 12:56 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
0
Yeah,i knew but why does the result look like that
20th May 2019, 12:59 PM
ENDERllama 15
ENDERllama 15 - avatar