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 #940
print(dict(enumerate(["a", "b",], 100)))
You can use enumerate() . Also, enumerate() takes as a second argument the first integer of the counter. Here, the result will be {100: 'a', 101: 'b'} (index first, then value). (realpython.com/python-enumerate)
What is the output of the code snippet below?
— The Python Quiz (@thepythonquiz) July 19, 2021
print(dict(enumerate(["a", "b",], 100)))
{'a': 100, 'b': 100}
{'a': 100, 'b': 101}
{100: 'a', 100: 'b'}
{100: 'a', 101: 'b'}
π Comment the answer, like and retweet! #python
Question difficulty: π΅π΅π΅π΅π΅