Run Below Program in Python and Provide comments on the each code

Run Below Program in Python and Provide comments on the each code line what they are Doing
x = int(input(‘Enter value of x: ‘))
y = int(input(‘Enter value of y: ‘))
# Task1
def task1_function(x, y):
nested_list = []
for i in range(x):
inner_list = []
for j in range(y):
inner_list.append(0)
nested_list.append(inner_list)
return nested_list
nested_list_1 = task1_function(x, y)
print(nested_list_1)
# Task2
def task2_function(x, y):
nested_list_2 = []
for i in range(x):
inner_list_2 = []
for j in range(y):
if (i+1) % (j+1) == 0:
inner_list_2.append(1)
else:
inner_list_2.append(0)
nested_list_2.append(inner_list_2)
return nested_list_2
nested_list_2 = task2_function(x, y)
print(nested_list_2)
# Task 3
def task3_function(x, y):
for i in range(x):
for j in range(y):
if nested_list_2[i][j] == 1:
print(‘Index:’,i,j)
task3_function(x, y)
 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code “Newclient”

The post Run Below Program in Python and Provide comments on the each code appeared first on Superb Professors.

"Order a Custom Paper on Similar Assignment! No Plagiarism! Enjoy 20% Discount"