Search code examples
pythonmessage

I don't understand this error message (Python)


I'm just beginning Python and I wrote this small program that's supposed to take user input and print a result. However, I don't understand the error that's occuring when I run it:

Code:

# The purpose of this program is to use the user's input (the price of their meal), and outputs a receipt telling them how much the meal costs with tax and an optional tip.

print("Thank you for coming! We hoped you enjoyed the meal. Please use our all new PythonBillPayer! A fast way to pay for your day!")

PriceOfMeal = float(input("Please enter the price of your meal"))
TipAmount = float(input("Please enter amount of tip you would like to give"))

def receiptCalculation(PriceOfMeal, TipAmount):
    NewPrice = (((((13/100)*PriceOfMeal)) + PriceOfMeal) + TipAmount)
    return NewPrice

print(receiptCalculation(PriceOfMeal))

Error Message:

builtins.TypeError: receiptCalculation() missing 1 required positional argument: 'TipAmount'

Solution

  • The method receiptCalculation need to Arguments: PriceOfMeal and TipAmount. receiptCalculation(PriceOfMeal) passes only one argument to the method, so it raises an Error.