Question: PYTHON - keep getting errors. Please format my code properly so it works. Send screenshot of formatted code. And screenshot of output. Thanks. Test data:
PYTHON - keep getting errors. Please format my code properly so it works. Send screenshot of formatted code. And screenshot of output. Thanks.

Test data: input: price of product (float) output: the cost of each item with tax (float) and total amt spent (float) params: string (str) , float( real values) return: float (real values) """ state = input('Which state are you making the purchase in? ') tax = 0.4 if (state.lower() == 'austin'): print('You are in Austin so the sales tax rate is .08') tax = 0.08 total = 0 items = ['first', 'second', 'third', 'fourth'] for i in range(4): price = float(input('The ' + items[i] + ' product price: ')) category = int( input('What is the category of item being purchased(1. gasoline, 2. tobacco, 3. alcohol, 4.other)? ')) item = (price * (1 + tax)) if category == 1: print('an additional $1.60 in gasoline excise tax is added') item += 1.6 elif category == 2: print('an additional $2.00 in tobacco excise tax is added') item += 2 elif category == 3: print('an additional $5.00 in alcohol excise tax is added') item += 5 else: print('There are no excise taxes on this product.') print('The total price on ' + items[i] + ' item is $' + str(item)) total += item print('Total amount spent is $' + str(total))
13 14 15 state input (which state are you making the purchase in? tax = 0.4 if (state.lower'austin'): 17 18 19 print('You are in Austin so the sales tax rate is .08') tax = 0.08 total = 0 items= [.first', 'second', for i in range (4): 23 24 25 'third', 'fourth.] 27 28 29 30 31 32 price float (input ('The + items [i] + ' product price : ')) category int( input ('What is the category of item being purchased (1. gasoline, 2. tobacco, 3. alcohol, 4.other)? item = (price * (1 + tax)) if category 1: 34 35 print ('an additional $1.60 in gasoline excise tax is added) 37 38 39 item += 1.6 elif category2: print ('an additional $2.00 in tobacco excise tax is added') item += 2 elif category 3: 45 print ('an additional $5.00 in alcohol excise tax is added') 47 48 49 50 51 52 53 54 item += 5 else: print('There are no excise taxes on this product.) print( 'The total price on'itemsi te is $str (item)) total += item print'Total amount spent is $+str (total) Run salestax NameError name 'items' is not defined Process finished with exit code 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
