Basic Python - Lists

Descripción

Lists concepts for basic Python 2
Rebecca Noel
Fichas por Rebecca Noel, actualizado hace más de 1 año
Rebecca Noel
Creado por Rebecca Noel hace casi 8 años
92
1

Resumen del Recurso

Pregunta Respuesta
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
Mostrar resumen completo Ocultar resumen completo

Similar

Python Quiz
karljmurphy
Think Python
tsilvo2001
PEGA CSSA Prep
Wendell Phipps
IRREGULAR VERB LIST
Núria Gispert
Basic Python - Print Formatting
Rebecca Noel
What is Python?
Daniel Ingram
Computer science unit 2
Somto Ibeme
Python
54671
Know your Python!
educ8ict
Basic Python - Strings
Rebecca Noel
Study on IoT systems design
Tomasz Cieplak