Show the output of the following two programs:
def main():
number = 0
numbers = [10]
m(number, numbers)
print("number is", number, "and numbers[0] is",numbers[0])
def m(x, y):
x = 3
y[0] = 3
main()
(a)
def main():
lst = [1, 2, 3, 4, 5]
reverse(lst)
for value in lst:
print(value, end = ' ')
def reverse(lst):
newLst = len(lst) * [0]
for i in range(len(lst)):
newLst[i] = lst[len(lst) - 1 - i]
lst = newLst
main()
(b)
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.