Question: Consider the following small programs. What will the output be? a.) def foo(a): x = bar(a) return a * 3 def bar(a): x = a
Consider the following small programs. What will the output be?
a.)
def foo(a): x = bar(a) return a * 3 def bar(a): x = a + 2 return x x = foo(5) print(x)
b.)
def foo(a): return a * 2 x = 5 x = foo(x) print(x)
c.)
def say_hello(name, age): print('Hello,', name, '- you are', age, 'years old.') say_hello(22, 'Alice')
d.)
def foo(): print('foo') def bar(): print('bar') foo() def zam(): bar() print('zam') foo() zam()
e.)
def foo(x): print(x) def bar( ): return 2 def baz(y, z): return y * z a = bar( ) + 3 b = baz(a, 3) foo(a + b)
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
