PCEP 30 02 PCEP Certified Entry Level Python Programmer · Free Practice Question Medium
Question 18
What is the output of the following code snippet?
- inp = {'Course':'PCEP','pass_percent':80,}
- temp = {'Course':'PCEP','pass_percent':70,'tech':'Python'}
- inp.update(temp)
- print(inp)
-
A
{'Course':'PCEP','pass_percent':80,'tech':'Python'}
-
B
{'Course':'PCEP','pass_percent':70}
-
C
{'Course': 'PCEP', 'pass_percent': 70, 'tech': 'Python'}
-
D
{'Course': 'PCEP'}
Reveal correct answer
Correct answer: C
Explanation
update() method will update the values of the keys. It will also add a new key-value pair.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
You must be logged in to post a comment.
