Python Forum
Bill calculator with different prices
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bill calculator with different prices
#7
Thank you very much for your answer.
I'm assuming that I made 50 photocopies (is this the input you are referring to?)
Regarding lines 7 and 8, here is the logic. Let's say I make 29 copies (more than 10 but less than 30) In this case I would be charged 10 cents for each of the first 10 photocopies and 9 cents for each of the next 19 copies.

How do I fix the total_price variable? How do I define a variable whose value is contingent upon that of another variable (n in this case)?

The input I am using is the code on lines 1, plus the number 50 I entered when "Number of copies" appeared on line 2, plus the code on lines 3 to 11

Regarding lines 9 and 10, here is the logic. Let's say I made 50 copies (as I am assuming). I would be charged 10 cents for each of the first 10 copies, 9 cents for each of copies 11 to 30, and 8 cents for each of copies 31 to 50.
Reply


Messages In This Thread
RE: Bill calculator with different prices - by JHPythonLearner - Sep-14-2018, 07:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help with creating dynamic columns with for loops for stock prices PaDat 2 1,004 Feb-22-2023, 04:34 AM
Last Post: PaDat
  SMA (simple moving avg) Not receiving Data (stock prices). gdbengo 2 1,526 Jul-31-2022, 08:20 PM
Last Post: paulyan
  Different prices per hour kemper 1 2,091 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