How do you make an argument in an argument optional?
Use None.
E.g.
def describe_pet(animal, name=None):
"""Display information about a pet."""
print("\nI have a " + animal + ".")
if name:
print("Its name is " + name + ".")Can you pass a list to a function without having to “unpack” the list?
Yes
What’s an easy way to pass a list as a copy to a function?
Use brackets with a colon after the list to select all items
E.g.
print_models(original[:], printed)
How do you create a module for use in your code?
Create the function and store it in a script. Store that script in the same directory and then call it like a normal module. Use the same name as the name of the .py script file