Sep-15-2018, 12:14 AM
(Sep-14-2018, 09:59 PM)Larz60+ Wrote: delete line 2
replace line 3 with:
total_price = 0.0
Actually, there's no need for line 3 altogether - since total price is calculated in all 3 branches of
if/else
expression.Looks like an attempt to declare a variable - in Python, declarations are not needed
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.