Single Choice Not Set

QWhat will be the output after the following statements?
x = {'year': 2016, 'month': 'March'}
if 'day' not in x:
    x['day'] = 'Tuesday'
print(x)

ID: #4038 Python Dictionary MCQ 249 views
Question Info
#4038Q ID
Not SetDifficulty
Python Dictionary MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A ('day', 'Tuesday')
  • B {'day': 'Tuesday', 'month': 'March'}
  • C 'day': 'Tuesday', 'month': 'March', 'year': 2016
  • D {'day': 'Tuesday', 'month': 'March', 'year': 2016}
Correct Answer

Explanation

{'day': 'Tuesday', 'month': 'March', 'year': 2016}

Share This Question

Challenge a friend or share with your study group.