Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
def document(title, genre):
print(title, genre)

document("gg")
document("fiction")

What I have tried:

I tried making it document=gg and document=fiction.

I know this is probably easy but I am very new to this so please forgive my stupidity.
Posted
Updated 24-Sep-19 16:47pm

1 solution

Set default values for your params

Python
# SWAMI KARUPPASWAMI THUNNAI

def document(title="NO TITLE", genre="NO GERNE"):
    print(title, genre)


document(title="Titanic")
document(genre="Horror")
document(title="Terminator", genre="Sci-fi")



Output:

Titanic NO GERNE
NO TITLE Horror
Terminator Sci-fi
>>> 
 
Share this answer
 
Comments
Bc23 25-Sep-19 7:50am    
Oh ok, thank you, I thought you couldn’t define arguments inside the variables besides the first one.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900