Python Forum
Bill calculator with different prices
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bill calculator with different prices
#11
(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.
Reply


Messages In This Thread
RE: Bill calculator with different prices - by volcano63 - Sep-15-2018, 12:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help with creating dynamic columns with for loops for stock prices PaDat 2 914 Feb-22-2023, 04:34 AM
Last Post: PaDat
  SMA (simple moving avg) Not receiving Data (stock prices). gdbengo 2 1,468 Jul-31-2022, 08:20 PM
Last Post: paulyan
  Different prices per hour kemper 1 2,037 Jan-29-2019, 11:06 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020