python - global name not defined error -


itemprop = "text">

I am getting an error with my discount variable Name-error: The global name 'discount' is not defined Please look at your code and help me I do not want to modify the parameters of the function at all.

  def finddiscount (quantity): If the quantity & gt; = 1 more volume & lt; = 9: discount = 0 elif volume & gt; = 10 more quantity & lt; = 19: discount = .2 elif volume> gt; 20 more quantity & lt; = 49: discount = .30 elif volume> = 50 more volume < = 99: discount = .40 elif volume & gt; = 100: Discount = .50 Return Discount Diff Consultant (Quantity, Price): Search Discus (Quantity) Disk = (Price * Quantity) * Discount Total = (Value * Quantity) Reason = (Value * Quantity) - (Value * Quantity (", $ 10.2"), "\ n \ t", "discount $", format (disk, "10.2"), "\ nDTP Main (): Quantity = int ("How many packages have been purchased?")) = Value = float (input) "value $", "quantity payable $", format (reason, "10.2"), cp = " ") (" How much is each item? ") Calc Tap (volume, value) main ()  

if you access it in the multi block area You will have to declare discount globally.

  discount = 0 df search discus (quantity): ... global discounts # discount discount global Copy = 1  
needs to be modified

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -