Sep-25-2017, 02:03 AM
Homework help - python newbie. I'm trying to run the following code:
Any insights would be apprecited.
def user_input(): order_amount = float(input('What is the order amount?')) State = (str.upper(input('What is the state?'))) # we're assuming they're entering the abbreviation? return(order_amount, State) def taxAmt(): if (State == 'WI'): TaxedAmt= order_amount * Tax return(TaxedAmt) def print_results(): if (State == 'WI'): print('The subtotal is ${sub:,.2f}.'.format(sub=order_amount)) print('The tax is ${tax:,.2f}.'.format(tax=order_amount * Tax)) print ('The total is ${tot:,.2f}.'.format(tot= order_amount + TaxedAmt)) else: print ('The total is ${tot:,.2f}.'.format(tot= order_amount)) #Define constant Tax = .055 print_results(taxAmt(user_input()))My output should look like this:
Quote:What is the order amount? 10but i'm getting this:
What is the state? WI
The subtotal is $10.00.
The tax is $0.55.
The total is $10.55.
What is the order amount? 10
What is the state? MN
The total is $10.00
Output:What is the order amount?10
What is the state?WI
followed by this error:Error:TypeError Traceback (most recent call last)
<ipython-input-2-5545011f6e00> in <module>()
22 Tax = .055
23
---> 24 print_results(taxAmt(user_input()))
TypeError: taxAmt() takes 0 positional arguments but 1 was given
I don't know what this means. Honestly, I was following the professor's example. What I initially tried instead of "print_results(taxAmt(user_input())" was simply calling "user_input()" but that didn't work either.Any insights would be apprecited.