MCQs > IT & Programming > Python > Analyse the given Python code and answer the question that follows. def prt2(n): y=0 k = 2*n - 2 for i in range(0, n): for j in range(0, k): print(end=' ') k = k - 2 for j in range(0, i+1): y=y+k return(y) def prt3(m): if m > 1: for i in range(2,m): if (m % 3) == 0: print('failure') break else: print('success') else: print('failure') n = 5 m=prt2(n) k=prt3(m-3) How many times the word 'success' will be printed in the output, when the above code is executed?

Python MCQs

Analyse the given Python code and answer the question that follows.

def prt2(n):

y=0

k = 2*n - 2

for i in range(0, n):

    for j in range(0, k):

        print(end=" ")

    k = k - 2

    for j in range(0, i+1):

        y=y+k

return(y)

def prt3(m):

if m > 1:

    for i in range(2,m):

        if (m % 3) == 0:

            print("failure")

            break

        else:

            print("success")

else:

        print("failure")

    

n = 5

m=prt2(n)

k=prt3(m-3)

How many times the word "success" will be printed in the output, when the above code is executed?


Answer

Correct Answer:


Explanation:

Note: This Question is unanswered, help us to find answer for this one

Python Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Python Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it