Python-Quizzes | Python List Quiz | Question 13

Question 13: Find the output of the following program:

filter_none

edit
close

play_arrow

link
brightness_4
code

d1 = [10, 20, 30, 40, 50
d2 = [1, 2, 3, 4, 5
print( d1 - d1 )

chevron_right


(A) [10, 20, 30, 40, 50]
(B) [1, 2, 3, 4, 5]
(C) [10, 20, 30, 40, 50,-1, -2, -3, -4, -5]
(D) No Output


Answer: (D)

Explanation: Unlike addition or relational operators, not all the arithmetic operators can use lists as their operands. Since the – minus operator can’t take lists as its operand no output will be produced. The program will produce the following error:

 unsupported operand type(s) for -: 'list' and 'list'


Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.