What will be the output of the following Python code snippet? D1={"amit":40, "jatin":45}D2={"amit":466, "jatin":45}D1>D2 A. True B. False C. Error D. None
Answers
Answered by
0
the answer is option number D. that is Error
Answered by
2
Error (Option C)
Explanation:
The given program is
D1={"amit":40, "jatin":45}
D2={"amit":466, "jatin":45}
D1>D2
Let us understand the program.
- In the first line, a dictionary D1 is defined.
D1={"amit":40, "jatin":45}
- In the second line, a dictionary D2 is defined.
D2={"amit":466, "jatin":45}
- In the third line, D1>D2. But we cannot compare two dictionaries.
- So, we get a error: '>' not supported between instances of 'dict' and 'dict'.
Therefore, option C is correct.
Refer the attached image for the output.
Attachments:
Similar questions
Computer Science,
2 months ago
English,
2 months ago
Math,
2 months ago
Economy,
6 months ago
English,
10 months ago