Answered step by step
Verified Expert Solution
Question
1 Approved Answer
how can i get this function to print properly and say i want a=2 and b=2 def get_total(a, b): #enclosed variable declared inside a function
how can i get this function to print properly and say i want a=2 and b=2
def get_total(a, b):
#enclosed variable declared inside a function
total = a + b
def double_it():
#local variable
double = total * 2
print(double)
double_it()
#double variable will not be accessible
print(double)
return total
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started