Python Lists Flashcards
Fill in the blank: lists are one of _ built-in data types in Python
4
What are those 4 data types?
Lists, sets, tuples, dictionaries
What are the 3 attributes of Python lists?
Ordered, changeable, allow duplicate values
How do you access list item values?
Reference the index number:
thislist[1] accesses the value of the 2nd item in the list
What method adds items to the end of a list?
append()
What method adds items at a specified index?
insert()
What method adds items from any iterable to the current list?
extend()
What list method takes away the specified item?
remove()
What list method removes the specified index?
pop()
What is the structure for a list comprehension?
[expression for item in iterable if condition == True]