निम्नलिखित का आउटपुट क्या होगा?
What will be the output of following ?
Y=[2,5J,6]
Y.sort()
A)
B)
C)
D)
Explanation:
Let's break down the code:
Y = [2, 5j, 6]
Y.sort()
Y
is a list containing elements:2
,5j
(a complex number), and6
.- The
sort()
method in Python does not work with mixed data types such as integers and complex numbers because they cannot be directly compared.
Since you cannot compare integers with complex numbers in Python, this will result in an error.
Answer: (C) Error.