Page 2 - HA
P. 2
Home Assignment
def f(number):
# Missing function body
print(f(5))
A. return “number”
B. print(number)
C. print(“number”)
D. return number
8. A _______________________ is a subprogram that acts on data and often returns a value.
9. What will be the output of the following Python code?
def test(x, y):
x = x + y
y += 1
print(x, y)
test(2, 1)
10. print() is a ______________________ function in Python.
B) Answer the following questions:
1) What will be the output of the following code:
def func1(x, y):
print(x*y)
def func2(x,y):
print(x+y)
func2(4,5)
func1(2,3)
2) What will be the output of the following code:
def sum(a,b,c):
return a+5, b+4, c+7
s1, s2, s3=sum(2, 3, 4)
print(s1, s2, s3)
3) What will be the output of the following code:
def message():
print("Hello")
m=message()
print(m)
4) What will be the output of the following code:
def message():
return("Hello"*4)
X=message()
print(X)
5) What will be the output of the following code:
def func(X, Y):
print(Y+X)
func('Program', 'Python')