Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python using idle... I have this program... when I entered 25000 for sales and 100 for advence. I get a local variable error. Whats wrong

Python using idle... I have this program... when I entered 25000 for sales and 100 for advence. I get a local variable error. Whats wrong with this code?

def get_sales()->float: sales=float(input("Enter the monthly sales:")) return sales

def get_advanced_pay()->float: print("Enter the amount of advanced pay, or enter 0 if no advanced pay was given.") advanced_pay=float(input("Advanced pay:")) return advanced_pay

def determine_comm_rate(sales)->float: if sales<10000.00: rate=0.1 elif sales<14999.99: rate=0.12 elif sales<17999.99: rate=0.14 elif sales<21999.99: rate=0.18 return rate

def main(): # Get the amount of sales from user sales = get_sales() # Get the amount of advanced pay from user. advanced_pay = get_advanced_pay() # Determine the commission rate. comm_rate = determine_comm_rate(sales) # Calculate the pay. pay = sales * comm_rate - advanced_pay # Display the amount of pay. print('The pay is $', format(pay, ',.2f'), sep='') # Determine whether the pay is negative. if pay < 0: print('The salesperson must reimburse the company.')

if __name__=="__main__": main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions