Menu

Arrays (Lists)

Card 1 of 10 0 got it 0 still learning
Question
TapClick or press space to see the answer
Answer
All 10 cards in this set
How do you create an empty list in Python?
Using empty square brackets []
Which method adds an item to the end of a list?
append()
How do you remove the last item of a list?
Using the pop() method
How can you remove 'item2' from a list?
Using the remove() method
How do you sort a list in ascending order?
Using the sort() method
How do you access the first item of a list?
Using index 0
How do you create a new list by copying an existing list?
Using the list() function or the [:] syntax
How do you change the value of the first item in a list to 'new value'?
By assigning 'new value' to the first index
How can you add multiple items to a list at once?
Using the extend() method
What does the expression my_list[-1] return?
The last item of the list