Flashcards
Python definitions
Cards in this deck (2)
- 1What is a list comprehension?List comprehensions are a tool for transforming one list (any iterable actually) into another list. During this transformation, elements can be conditionally included in the new list and each element can be transformed as needed.
If you’re familiar with functional programming, you can think of list comprehensions as syntactic sugar for a 'filter' followed by a 'map'. - 2What is a tuple?A tuple is a collection which is ordered and unchangeable. In Python tuples are written with round brackets.
Example
Create a Tuple:
thistuple = ("apple", "banana", "cherry")
print(thistuple)
Information
- Description
- Python Flashcards on Python definitions, created by Ben Parish on 28/01/2020.
- Created by
- Ben Parish
- Views
- 0
- Rating