Python End-Sem 2023
Python End-Sem 2023
Q9. (a). Write comments for each line of the following Python code [6]
(b). Write a conclusion about what the code is written for. [CO1]
(C). Write the outcome of the "print" function and the value of the variable x after the
execution of the code.
Line Code
Number
1 def my_func (k):
2 if(k> 0):
3
result = k+my_func (k-1)
4 print(result)
else:
6 result =0
7 return result
X= my_func(7)