πŸ“Š Python
Q. What is the output of the following code?
Code:
def add(init = 5, *nbr, **key):
   c = init
   for n in nbr:
      c+=n
   for k in key:
      c+=key[k]
   return c
print(add(100,2,2, x=20, y=10))
  • (A) 136
  • (B) 134
  • (C) 100
  • (D) 122
πŸ’¬ Discuss
βœ… Correct Answer: (B) 134

Explanation: The function adds 2, 2, 20 and 10 to the initial value 100, so the result is 134

Explanation by: Tanmay
The function adds 2, 2, 20 and 10 to the initial value 100, so the result is 134

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
271
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Tanmay
Publisher
πŸ“ˆ
91%
Success Rate