r/learnpython • u/Emergency-Egg-0230 • 1d ago
Function without argument
Ive got a function that takes a dictionary as an argument.
Now Id like to program it so when the function is called without any argument, instead of an error message it prints something custom (a dictionary for example).
Any help is appreciated :D
1
Upvotes
View all comments
Show parent comment
0
u/stepback269 1d ago
Yes. I was going to say the same thing.
Use a keyword/ default value parameter such as:
def my_callable(Default_dict = [1: "one", 2:"two", 3: "three"]):
return None