Karteikarten
Basic Python - Lists
Karten in diesem Stapel (13)
- 1T/F?: A list is mutable, meaning the elements inside can be changed.True
- 2A list is constructed by...- assigning the list to a variable
- construct the list between brackets []
- and separate elements with commas - 3What is the difference between the len() function with lists vs. strings?len() of list will tell you how many elements are in the list.
len() of string will tell you how many characters are in string. - 4T/F?: You can concatenate lists like with strings.True
- 5T/F?: When you concatenate a list that permanently changes the list.False. You have to reassign the list in order to add something permanently.
my_list = my_list + ['new thing'] - 6What are two major reasons lists in Python are more flexible than arrays in other languages?1. the lists have no fixed size
2. and no fixed type constraint - 7What is the default indexed item in the pop() method? l.pop()-1
- 8Can you index something that doesn't have an item in the list?No, it will output an error
- 9What does nesting mean with Python lists?You can put data structures within data structures. (a list inside a list)
- 10T/F?: We use several sets of brackets to narrow down the item within the list within the list.True.
matrix[0][0] - 11What does Python's advanced feature called list comprehensions allow?It allows for quick construction of lists. Like grabbing just the first element of every list.
- 12Jupyter Notebook: When typing you can hit tab to...auto complete the word
- 13Jupyter Notebook: After typing in method you can shift + tab to ...see what the method does
Informationen
- Beschreibung
- Lists concepts for basic Python 2
- Erstellt von
- Rebecca Noel
- Aufrufe
- 162
- Tags
- Bewertung