Final Quiz
Final Quiz
Q2. Choose the values of the variables start, end, number and step so that the program produces the output displayed in
the output box. 4
if number == 18:
break
Q3. Answer the following questions. 2+3 = 5
i) What will be the output of the following Python program?
ii) How would you change the following code segment so that the word “Python” is displayed? You are allowed
to modify/insert/delete line(s) in the body of the while loop.
Q5. Define a function named 'fun' so that the following code segment produces an output shown in the output box. 5
print(fun(4)) 100
100
print(fun(4, 5))
print(fun(4, 5, 80))
Q6. Choose the values of num1, num2 and num3 so that the following program displays "Python is Fun.". 9
#Python program for Q6
def just_for_fun(id, num1 = ?, num2 = ?, num3 = ?):
x = fun1 (id + num1) Answer:
y = fun2 (x*num2 + 1) num1 =
z = fun3 (y*num3 + 1)
num2 =
def fun2(b):
if (b == 1):
print("...Sorry, too much for me!")
return 0
elif (b%2 == 0):
print("is", end = " ")
return 1
else:
print("..Sorry, I lost track here! Let me try next one.", end = "...")
return 1
def fun3(c):
if (c == 1):
print("........Sorry, I am done with Python!")
elif (c%2 != 0):
print("Fun", end = ".")
else:
print("....Sorry, I failed again.")
Output for N = 4:
1
121
12321
1234321