The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
Question #115
There is no explicitly defined method to add an item to a dictionary. From Python 3.5 onwards, the syntax {**my_dict, 'new_key': new_val} can be used. (stackoverflow.com/questions/1024847/how-can-i-add-new-key...)
Which syntax below won't work to add a new item to the dictionary my_dict? (Python 3.5+)
— The Python Quiz (@thepythonquiz) January 5, 2021
my_dict.add('new_key','new_value')
my_dict.update({'new_key':'new_value'})
{**my_dict, 'new_key': new_val}
my_dict['new_key'] = 'new_val'
π Comment the answer, like and retweet
Question difficulty: π΅π΅π΅π΅π΅
Similar questions: