Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following Python code?
>>> a=(1,2,(4,5))
>>> b=(1,2,(3,4))
>>> a< b

What will be the output of the following Python code?
>>> a=(1,2,(4,5))
>>> b=(1,2,(3,4))
>>> a< b
a) true
b) false
c) Error, < operator is not valid for tuples
d) Error, < operator is valid for tuples but not if there are sub-tuples

Answer: a
Explanation: Since the first element in the sub-tuple of a is larger that the first element in the subtuple of b, False is printed.

Join The Discussion