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 #101
The extend() function adds [4, 5] as a whole to the iterable [1, 2, 3] e.g. [1, 2, 3,[4,5]] . In return, the function append() appends an object at the end of a list. Here, the individual elements of [4, 5] e.g. 4 and 5 are appended to [1, 2, 3] . (stackoverflow.com/questions/252703/what-is-the-difference...)
Which code snippet will return [1, 2, 3, [4, 5]]?
— The Python Quiz (@thepythonquiz) June 26, 2020
x = [1, 2, 3]
x.append([4, 5])
x
x = [1, 2, 3]
x.extend([4, 5])
x#python #python3 #pythonprogramming #learnpython
Question difficulty: π΅π΅π΅π΅π΅
Similar questions: