2017-09-14 13 views
-2

j'ai un morceau de code et après mes entrées je demande une entrée seulement si l'entrée de l'endroit est ce qu'il dit mais demande l'entrée même si je n'ai pas entré la nourriture par exemple et demander où ont u mangé est là de toute façon de résoudre ce problème, donc je peux demander une entrée après une instruction ifje ne peux pas mettre d'entrée après si déclaration python

print("Welcome to how much i spend made my Arran") 

price1 = float(input("how much was your first purchase this mounth")) 
where1 = input("Where did you spend this shops, food, entertainment, mortage, bills, supermarket") 

if where1 == "shops" or "Shops" or "shop" or "Shop": 
    shop1 = input("What was the name of the shop") 

if where1 == "Food" or "food": 
    food1 = input("What was the name of the restraunt or fast food u ate at") 


if where1 == "entertainment" or "Entertainment": 
    entertainment1 = input("What type of enternainment was it") 

if where1 == "Supermarket" or "supermarket": 
    supermarket1 = input("What supermarket was it") 
    *emphasized text* 
+0

s'il vous plaît formater votre code. –

Répondre

0

Votre déclaration conditionnelle n'est pas correct

Vous devez utiliser quelque chose comme ceci à la place:

if where1 in ["shops", "Shops", "shop", "Shop"]: 
    # Blah Blah