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

निम्नलिखित कोड स्निपेट का आउटपुट क्या होगा?

What will be the output of the following code snippet ?

numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
odd_numbers = [x for x in sorted_numbers if
x % 2 != 0]
print(odd_numbers)
A)
B)
C)
D)

Explanation:

Here’s how the code works:

  1. The tuple numbers is sorted: [2, 4, 7, 19, 22, 45, 72, 89].
  2. It then filters out the odd numbers: [7, 19, 45, 89].
  3. Finally, it prints the list of odd numbers.

Output: [7, 19, 45, 89]

Answer: (A)

Latest Updates