# How to fix: "Error: missing 2 required positional arguments"? (basic python)

This is the code I’m working with. This is my function below, but I’m getting the error in the first line (def calculateBMI…). Now, I did some research and it says height and weight are passing thru to the function, but idk how to resolve it. Above this, I have height and weight already defined as variables with inputs. So I’m not understanding why it would give me this error:

TypeError: calculateBMI() missing 2 required positional arguments: ‘height’ and ‘weight’

Any help appreciated, thank you.

`height=float(input("What is your height in inches?\n"))`

`weight=float(input("What is your weight in pounds?\n"))`

``````def calculateBMI(height: float, weight: float):
if (not isinstance(height, float)) | (not isinstance(weight, float)):
raise TypeError("height and weight variables not of type float")
print(height)
print(weight)
``````

When you call the function you must provide 2 parameters and you did not.
You have not shared the code that does the call so I do not know what you tried.

The call should look something like:

``````h = float(input("What is your height in inches?\n"))
w = float(input("What is your weight in pounds?\n"))
calculateBMI(h, w)
``````

Of course I can answer this directly, but I think it is much more valuable to show you the analysis skills that you need to solve problems like this for yourself. My way to do this is mostly to ask questions - both so that you can see what you already know and don’t know, and start to reason about the gaps; and so that I can understand your exact situation and see if something actually misled you or if your understanding is only incomplete.

Let’s start here. First off: what do you mean by “it says” - what is “it”? When you are surprised that “it would give me this error” - again, what is “it”? The code that you’ve shown so far doesn’t won’t use the `calculateBMI` code at all - this only explains how to do something (defines a function), but doesn’t request to do it (call it).

The error message that you show, would happen if you have some code somewhere else that says `calculateBMI()`. Is that an accurate understanding of what you actually have?

Then, we can move on to the next part. I can’t really understand what you’re trying to say in the first sentence - it seems like you don’t quite understand what all the words mean, but I can’t tell what you think they mean. In particular, it sounds like you think that passing the values to the function is a bad thing, but it is not. The problem is that the code doesn’t do this, when it should.

So the last questions are all about what you understood so far from your research. For example: from what you read, did you see something that explains what an argument to a function is? What did you learn there? (I assume you understand “missing” and “required”, because those are ordinary English words; and “positional” is not really important here.) And, in terms of what calling a function looks like: did you understand that in this code, you are calling other functions - such as `print` and `isinstance` - that were already defined for you?

You may find a useful hint here: when you use `print(height)`, what is accomplished by putting the `height` there? Why would it not work, to just write `print()`, and expect Python to know that the `height` should be printed?