python - Syntax Error: EOL while scanning string literal -


i wrote this:

 def compute_bill(food):     total = 0     while item in food:         if item's stock count > 0:         total += prices[item]         item's stock count = item's stock count - 1 

then, got syntax error: eol while scanning string literal can me, please!

the ' starts string, , have used in 3 places. causes 2 strings: 1 has apostrophe @ start , end, , unclosed one. unclosed 1 causes eol error because python interpreter runs out of code inspect before string finished.

to fix not use apostrophies (or spaces) in variable names:

def compute_bill(food):    total = 0    while item in food:        if item_stock_count > 0:            total += prices[item]            item_stock_count = item_stock_count - 1 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -