Question: def show_message(): print('Welcome to the tip calculator.') print('This program will show you several options for a tip amount.') def show_tip(bill, percentage): # processing tip =
def show_message(): print('Welcome to the tip calculator.') print('This program will show you several options for a tip amount.')
def show_tip(bill, percentage): # processing tip = bill * percentage # output print('A ' + str(percentage) + ' tip on a $' \ + str(bill) + ' bill amounts to ' \ + float(tip, '1f') + ' .') # main program -- interacts with the user def main(): show_message() bill_amount = float(input('Please enter the amount of the bill: $'))
show_tip(bill_amount, 15) show_tip(bill_amount, 18) show_tip(bill_amount, 20) show_tip(bill_amount, 25)
main() # start the program
Traceback (most recent call last): line 29, in main() # start the program line 24, in main show_tip(bill_amount, 15) line 18, in show_tip + float(tip, '1f') + ' .') TypeError: float expected at most 1 arguments, got 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
