Here I keep getting an error message next to int(age) in my function definition. It says the syntax at that position is invalid but I’ve used the same syntax for the children variable
Due to the way the Python interpreter works, it won’t care about what you’ve done for the children parameter - it’ll never reach it because it throws the syntax error before it gets there, for your use of int(age) as a parameter.
Python, whilst a typed language, does not enforce type on variables or parameters - this is why when you define a string variable, for example, you simply type a_string = 'some text' and that’s sufficient.
You can provide type hints in your code, though. Whilst these are not enforced, and do nothing to prevent someone providing a different type to the one specified, they offer a suggestion as to the intended use. (If you’re working in VSCode, for example, when you make a call to a particular function it will use the type hints to show the expected output type as well as the expected type of the parameters.)
This is how you would use type hints:
def patient_search(name: str, max_results: int = 10) -> dict:
# some function code here
Here we are advising that the name parameter ought to be a string, max_results ought to be an integer (with a default value of 10, if the call to the function doesn’t specify otherwise), and that the function will return a dictionary type. None of this is enforced, of course, so your code would still be expected to validate the input - checking that what you expect to be a string/integer is not actually a boolean and a set - but you have more information about the code than you might if all you had was the parameter names.
Notwithstanding the excellent information given above by @thepitycoder, we will have discovered that on the basis that parameters are really just positional placeholders/labels for argument objects, they cannot be computed values. That means we cannot make function calls from within the parameter list. Those calls would be either in the arguments list (at the caller) or before the call.