🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित का आउटपुट क्या है?

What is the output of the following ?

t=(2, 3, 4, 3.5, 5, 6)
print(sum(t) + t.count(2))
A)
B)
C)
D)

Explanation:

Let's break down the code and understand it step by step:

Given:

t = (2, 3, 4, 3.5, 5, 6)
  1. sum(t): This function will return the sum of all the elements in the tuple t.

    • 2 + 3 + 4 + 3.5 + 5 + 6 = 23.5
  2. t.count(2): This function will count how many times the number 2 appears in the tuple t.

    • The number 2 appears once in the tuple.
  3. Now, we add these two results:

    • sum(t) = 23.5
    • t.count(2) = 1

    So, 23.5 + 1 = 24.5

Thus, the correct answer is (C) 24.5.

Latest Updates