Jan-31-2021, 03:38 AM
elif
is still an if
statment so it requires a test of some sort. The elif
by itself is the error. Here is an example :muffins = 13 cupcakes = 13 while True: buying = input () if buying == "0" : break elif buying == "muffin": if muffins > 0: muffins -= 1 else : print ("Out of stock") elif buying == "cupcake": if cupcakes > 0: cupcakes -= 1 else : print ("Out of stock") print("muffins:", muffins, "cupcakes:", cupcakes)