🔍
What is the output of the following code?
>>> a=(1,2,(4,5))
>>> b=(1,2,(3,4))
>>> a<b
a) False
b) True
c) Error, < operator is not valid for tuples
d) Error, < operator is valid for tuples but not if there are sub-tuples
0 like 0 dislike

1 Answer

a) False
0 like 0 dislike

Related questions

What is the output of the following piece of code when executed in Python shell? >>> a=("Check")*3 >>> a a) (‘Check’,’Check’,’Check’) b) * Operator not valid for tuples c) (‘CheckCheckCheck’) d) Syntax erro
Answer : c) (‘CheckCheckCheck’)...

View solution
0 like 0 dislike
1 answer

What is the output when following code is executed ? >>>list1 = [11, 2, 23] >>>list2 = [11, 2, 2] >>>list1 < list2 is a) True b) False c) Error d) None
Answer : b) False...

View solution
0 like 0 dislike
1 answer

Is the following piece of code valid? >>> a=(1,2,3) >>> b=('A','B','C') >>> c=zip(a,b) a) Yes, c will be ((1,2,3),(‘A’,’B’,’C’)) b) Yes, c will be ((1,2,3),(‘A’,’B’,’C’)) c) No because tuples are immutable d) No because the syntax for zip function isn’t valid

View solution
0 like 0 dislike
0 answers

What is the output of the following? i = 1 while True: if i%0O7 == 0: break print(i) i += 1 a) 1 2 3 4 5 6 b) 1 2 3 4 5 6 7 c) error d) none of the mentioned
Answer : a) 1 2 3 4 5 6...

View solution
0 like 0 dislike
1 answer

What is the output of the following code? >>> a=(2,3,4) >>> sum(a,3) a) Too many arguments for sum() method b) The method sum() doesn’t exist for tuples c) 12 d) 9
Answer : c) 12...

View solution
0 like 0 dislike
1 answer

50.5k questions

47.1k answers

240 comments

7.0k users