How are the keyword arguments specified in the function heading or definition?
What is the output of the following code ?
def foo():
var += 3
return var
var = 12
print(foo())
What is the output of the following code ?
x = 34
def scope_test(x):
print('x == ', x)
x = 2
print('X is changed to == ', x)
scope_test(x)
print('x is at outer scope', x)
What is the output of the following code ?
def printme(msg, count=1):
print(msg * count)
printme('Welcome')
printme('Pythoneasy', 2)
Which of the following is correct ?
Where you can define a function ?
Functions defined inside a class is known as ?
What is the output of the following code ?
def foo(x, y, z): return x + y + z
print(foo(10, 11, 12))
What is the output of the following code ?
def printer():
t = 'to PythonEasy'
fname = (lambda a: t + ' ' + a)
return fname
foo = printer()
print(foo('Welcome'))
What is the output of the following code ?
def foo(p=5, *args):
print(type(args))
foo(5, 6, 7, 8)
What is the output of the following code ?
def rec(a, b):
if a == 0:
return b
else:
return rec(a - 1, a + b)
print(rec(8, 12))