0

Create a new function named defaults with two parameters:

my_optional which has a default value of True my_required which is a required param and has no default value Return the following logical comparison:

my_optional is my_required Expected Output

defaults(True) True

defaults(True, False) False

defaults(False, False) True

def defaults(my_optional, my_required) my_optional = True return my_optional is my_required

i received the error *defaults is missing positional argument: my_required

stumpamo
  • 11
  • 1
  • You have a function with two positional arguments, so when calling the function both of them need to be provided in the call. If you want to assign a default value to an argument, use a keyword argument with a default value, e.g.: `def defaults(my_required, my_optional=True)`. – AlexK Feb 19 '23 at 20:52
  • Please see [How do I format my code blocks](https://meta.stackexchange.com/questions/22186/how-do-i-format-my-code-blocks). Also Stack Overflow's [markdown help](https://stackoverflow.com/editing-help) page. – AlexK Feb 19 '23 at 20:54

0 Answers0