+ 1
Practice: Coffee Time
Hello, I do not understand why this code is not working. Could anyone just give a hint to me please. def coffee(): choices=int(input()) 1=Americano 2=Espresso 3=Cappuccino if choices ==1: print("Americano") elif choices ==2: print("Espresso") elif choices ==3: print("Cappuccino") else: print("Unknown")
7 Answers
+ 9
Ahmed Alwan ,
too many issues in your code:
https://code.sololearn.com/ctAT84N3JWmj/?ref=app
+ 4
2 things Denis Durban
1 your code appears to have no indentations which python sees as blocks and the second or no. 2 is how or where did you call the function coffee()
def coffee(c):
blocks of your if elif(s) else here ...
c = int(nput())
coffee(c)
+ 3
BroFar Thank you. I fixed it and the code is working now.
+ 1
Great âș
+ 1
def coffee():
drinks = ["Americano", "Espresso", "Cappuccino"]
choice = int(input())
if choice == 1:
print(drinks[0])
elif choice == 2:
print(drinks[1])
elif choice == 3:
print(drinks[2])
else:
print("Unknown")
+ 1
coffe=int(input())
for i in range(1,3+1):
if coffe==1:
print("americano")
elif coffe ==2:
print("espresson")
elif coffe==3:
print("cappuccion")
else:print("unknown")
Done
+ 1
Lothar
What about now sir ?
Was in hurry and left fixing indentations for problem presenter
Try it now sir .....Thank U for ur point.
https://code.sololearn.com/c7Y7VfaqLTkL/?ref=app