Certain parts of python scipt not being executed

Biglemon29

Estimable
Sep 29, 2014
6
0
4,510
0
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

 

Biglemon29

Estimable
Sep 29, 2014
6
0
4,510
0


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
0


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

Honorable
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
 
Thread starter Similar threads Forum Replies Date
M Apps General Discussion 5
R Apps General Discussion 9
P Apps General Discussion 4
S Apps General Discussion 1
J Apps General Discussion 2
P Apps General Discussion 5
S Apps General Discussion 13
J Apps General Discussion 1
L Apps General Discussion 1
H Apps General Discussion 2
F Apps General Discussion 1
D Apps General Discussion 1
M Apps General Discussion 1
T Apps General Discussion 5
ZeTechKing Apps General Discussion 2
T Apps General Discussion 2
indyitguy Apps General Discussion 7
J Apps General Discussion 5
J Apps General Discussion 5
viveknayyar007 Apps General Discussion 0

ASK THE COMMUNITY