Python Forum
Unit 18 Procedural Programming Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unit 18 Procedural Programming Python
#5
You need a naming convention... you used newBalance as a function name and a variable... that's a no-no

while days>0:
    days = days + 1
that loop will never end. Because days will always be >0

updatedBalances = (newBalance + salesFigure - dailyexpenses) #this is to display the newbalnce on the users screen
there's no variable called newBalance or dailyexpenses from line 39 to 58. That why you have that error.

    sold = salesFigure // priceOfProduct - shopPrice
    if (sold > shopPrice):
        lackOfStock = sold - stock
        costProfit = lackOfStock*priceOfProduct #this is a block of code for If statement showing working out for handling products sold and in stock 
        sales = sales - costProfit
bunch of missing variables.

Anyways what j.crater was telling you before. The variable you define in your function are local variables. You can't grab the local variable and use in the main code or other function. You would need to create the variables again.
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Reply


Messages In This Thread
RE: Unit 18 Procedural Programming Python - by Terafy - Dec-17-2017, 02:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Homework Python unit test Paragoon2 4 1,643 Dec-12-2022, 12:45 PM
Last Post: Paragoon2
  Help with Unit Tests pdub787 3 3,196 Nov-20-2019, 07:45 PM
Last Post: ndc85430
  Verilog HDL Programming to Python Programming? noobcoder 1 3,138 Jul-18-2019, 09:28 PM
Last Post: nilamo
  Unit 18 Procedural Programming Python kanwal121 4 4,227 Dec-21-2017, 10:53 PM
Last Post: Terafy
  unit 18 codes Miss_Kaur 7 5,224 Dec-19-2017, 02:49 PM
Last Post: sparkz_alot
  Unit 18: Procedural Programming Assignment (Shop Simulation) shaheduk323 28 14,066 Dec-17-2017, 08:31 PM
Last Post: Terafy

Forum Jump:

User Panel Messages

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