Code :
def example_function(positional_arg, default_arg="default_value", *args, **kwargs):
#Function to demonstrate different types of arguments.
print("Positional Argument:", positional_arg)
print("Default Argument:", default_arg)
print("Additional Positional Arguments (*args):", args)
print("Additional Keyword Arguments (**kwargs):", kwargs)
print()
# Example usage
example_function("Positional Argument")
example_function("Positional Argument", "Custom Default Value")
example_function("Positional Argument", "Custom Default Value", 1, 2, 3)
example_function("Positional Argument", custom_kwarg1="Value1", custom_kwarg2="Value2")
No comments:
Post a Comment