Erstellt von Rebecca Noel
vor fast 8 Jahre
|
||
Frage | Antworten |
T/F?: A list is mutable, meaning the elements inside can be changed. | True |
A list is constructed by... | - assigning the list to a variable - construct the list between brackets [] - and separate elements with commas |
What 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. |
T/F?: You can concatenate lists like with strings. | True |
T/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'] |
What 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 |
What is the default indexed item in the pop() method? l.pop() | -1 |
Can you index something that doesn't have an item in the list? | No, it will output an error |
What does nesting mean with Python lists? | You can put data structures within data structures. (a list inside a list) |
T/F?: We use several sets of brackets to narrow down the item within the list within the list. | True. matrix[0][0] |
What 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. |
Jupyter Notebook: When typing you can hit tab to... | auto complete the word |
Jupyter Notebook: After typing in method you can shift + tab to ... | see what the method does |
Möchten Sie mit GoConqr kostenlos Ihre eigenen Karteikarten erstellen? Mehr erfahren.