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 #307
See the code below:
from sys import getsizeof
n = 10
d = dict(enumerate(range(n)))
print(getsizeof(d))
lot = list(d.items())
print(getsizeof(lot) + sum(map(getsizeof, lot)))
>>368
>>840
(twitter.com/raymondh/status/1234864681421918208)
When the length is bigger than 3, which one is more compact?
— The Python Quiz (@thepythonquiz) December 10, 2020
Lists of 2-tuples
Dictionaries#python #python3 #pythonprogramming #learnpython
Question difficulty: π΅π΅π΅π΅π΅