What is the output of the following code ?
p = round(1.61) - round(-1.61)
e = round(0.5) - round(-0.5)
print(p, e)
What is the output of the following code ?
def foo(arg, value):
print(arg(value))
foo(max, [4, 5, 6])
foo(min, [4, 5, 6])
What is the output of the following code ?
def foo():
print("Welcome to pythoneasy.com")
foo()
foo()
Python can create anonymous functions using keyword
What is the output of the following code ?
foo = [lambda x: x ** 2,
lambda x: x ** 3,
lambda x: x ** 4]
for f in foo:
print(f(2))
What is the output of the following code ?
k=0
def foo(k):
k += 1
return k
foo(k)
print(k)
What is the output of the following code ?
def foo(p=5, **args):
print(type(args))
foo(5, a='python', b='easy')
What is the output of the following code ?
def foo():
x = 25
print(x)
x = 50
foo()
What is the output of the following code ?
def foo():
global x
x += 1
print(x)
x = 12
print(x)
What is the output of the following code ?
def foo():
global x
print(x)
x = "hi"
print(x)
x = "welcome"
foo()
print(x)
What is the output of the following code ?
def func(x, y, z):
global s
x = 10
y = 20
z = 30
s = 40
print(x, y, z, s)
x, y, z, s = 1, 2, 3, 4
func(5, 10, 15)
What is the output of the following code ?
x = 200
def foo():
global x
x = 50
def boo():
global x
x = 67
print(x)
Which data type do the function globals() and locals() returns
What is the output of the following code ?
x = 45
globals()['x'] = 95
print(x)
What is the output of the following code ?
def factorial(number):
if number == 0:
return 1
else:
return number*factorial(number-1)
print(factorial(5))
What is the output of the following code ?
def foo(n):
if n > 90:
return n - 4
return foo(foo(n + 10))
print(foo(45))
Which one is incorrect about recursive function ?