Q. What will be the output of the following Python code?

Code:
def function1(var1,var2=5):
    var1=2
    var3=var1*var2
    return var3
var1=3
print(function1(var1,var2))
  • (A) 10
  • (B) 15
  • (C) Error as var2 is not defined while calling the function
  • (D) Does not give any error as var2 is a default argument
πŸ’¬ Discuss
βœ… Correct Answer: (C) Error as var2 is not defined while calling the function

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
154
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
87%
Success Rate