Skip to content
Related Articles

Related Articles

Improve Article
Python-Quizzes | Python List Quiz | Question 13
  • Last Updated : 17 Sep, 2020

Question 13: Find the output of the following program:




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

(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
Recommended Articles
Page :