Args and Kwargs Flashcards
1
Q
create a function where you can pass any number of these “blog_” and then print them out
blog_1 = 'I am so awesome' blog_2 = 'Cars are cool.' blog_3 = 'Aww look at my cat.'
A
def blog_posts(*args): for post in args: print(post)
blog_posts(blog_1)
will print I am so awesome
blog_posts(blog_1,blog_2,blog_3)
this will print all 3 lines.