Certain parts of python scipt not being executed

Biglemon29

Estimable
Sep 29, 2014
6
0
4,510
Under the choose option 2 part. If the input is bread the rest of that part won't run. The script just ends there. What is wrong can someone tell me? I don't get any error message the script just stops. Other than that everything works



bread = 44
lettuce = 21
meat = 21
cheese = 23
sandwich = bread, lettuce.meat, cheese

choseOption = input('What you like to mark an order, add to stock, or check stock')

if choseOption == 1:
newOrder = input('what did they order?')
if newOrder == 'sandwich':
bread = bread - 4
lettuce = lettuce - 5
meat = meat - 7
cheese = cheese - 10
print(bread)
print(lettuce)
print(meat)
print(cheese

if choseOption == 2:
newStock = input('What would you like to add to stock?')
if choseOption == 'bread':
addBread = input('How much bread would you like to add? ')
bread = bread + addBread

if newStock == 'lettuce':
addLetuce = input('How much lettuce would you like to add?')
lettuce = lettuce + addLetuce

if newStock == 'meat':
addMeat = input('how much meat would you like to add?')
meat = meat + addMeat

if newStock == 'cheese':
addCheese = input('how much cheese would you like to add?')
cheese = cheese + addCheese

 
Solution
It's painfully simple. You are assigning "newStock" the input value but are checking "choseOption" to make your decision. All of the other blocks correctly check against "newStock".

Biglemon29

Estimable
Sep 29, 2014
6
0
4,510


I don't understand what you are saying. can you post the updated code? maybe then I will understand. Thx for the help though
 

Biglemon29

Estimable
Sep 29, 2014
6
0
4,510


never mind I got it. Sometimes I just make silly mistakes like that and I can't find them. thx for the help
 

ex_bubblehead

Distinguished
Moderator
Can't be any simpler

if choseOption == 2:
newStock = input('What would you like to add to stock?') <-- You assign a value to "new Stock" here
if choseOption == 'bread': <-- You check here. Note that you are not checking against the input value you assigned above.
addBread = input('How much bread would you like to add? ')
bread = bread + addBread