Question: The variable color is a local variable - it is unique only to the green function. If we attempt to run this code, it will
The variable color is a local variable it is unique only to the green function. If we attempt to run this code, it will fail because color does not exist within the scope of the favcolor function.
Rewrite the code so the variable color, is passed as an argument from green to favcolor.
When you are finished, the output should match that under Desired Output# Define the green function
def green:
color "green"
favcolor
# Define the color function
def favcolor:
printMy favorite color iscolor
# Call the green function
green
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
