Post

Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
18
12
129
13.1K
Coding Computing Coach
Coding Computing Coach@CodingComputing·
@PythonPr Answer: B Solution: Let's take a look at what `extend` list method does. Here we start with a list `li`, initialized to ['W']. Now we run the `.extend` list method, with the argument 'XYZ' li.extend('XYZ') The `extend` method works by +
English
1
0
3
719
Coding Computing Coach
Coding Computing Coach@CodingComputing·
@PythonPr ✅ takes an iterable argument (like str, list, etc.) ✅ appends the items of the argument to the original list The argument is 'XYZ', a string iterable, with items: 'X', 'Y', and 'Z' Each of these will now be appended to the original list, which was ['W'], resulting in +
English
1
0
0
113
Paylaş