Question: 1. Please write the following Python 3 Program also show all output and comment on program. Write a function that has four optional parameters (with
1. Please write the following Python 3 Program also show all output and comment on program.
Write a function that has four optional parameters (with defaults):
fore_color
back_color
link_color
visited_color
Have it print the colors (use strings for the colors)
Call it with a couple different parameters setusing just positional arguments:
func('red', 'blue', 'yellow', 'chartreuse')
using just keyword arguments:
func(link_color='red', back_color='blue')
using a combination of positional and keyword
``func('purple', link_color='red', back_color='blue')
using *some_tuple and/or **some_dict
regular = ('red', 'blue')
links = {'link_color': 'chartreuse'}
func(*regular, *links)
Generic parameters:
Write a the same function with the parameters as:
*args and **kwags
Have it print the colors (use strings for the colors)
Call it with the same various combinations of arguments used above.
Also have it print args and kwargs directly, so you can be sure you understand whats going on.
Note that in general, you cant know what will get passed into **kwargs So maybe adapt your function to be able to do something reasonable with any keywords.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
