Q. What is wrong with following function code? Find reason and correct it.


def addThree (n1, n2, n3):
    return n1 + n2 + n3
    print("the answer is", n1 + n2+ n3)


Reason :-
Corrected code :-


Answer :-


Reason :- There is no error in program but if run the program print statement will not work.

Corrected code :-

def addThree (n1, n2, n3):
    return n1 + n2 + n3

#OR

def addThree (n1, n2, n3):
    print("the answer is", n1 + n2+ n3)

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post