Flashcards
Python
Cards in this deck (18)
- 1extend()?
- 2dict()?
- 3def()?
- 4list()?
- 5lower()?
- 6hasattr(obj, '__call__')to detect if a variable is a function
- 7A tuple is immutableYes
- 8A list is mutable.Yes
- 9A tuple is mutableNo
- 10A list is immutable.No
- 11type(0,)tuple
- 12A tuple is an immutable data structure in Python. Can it hold mutable objects?Yes
- 13enumerate?
- 14If a list is mutable in Python, can it hold immutable objects?Yes
- 15for i in range 1The for loop is commonly used to repeat some code a certain number of times. This is done by combining for loops with range objects.
- 16insert()?
- 17list(range(3, 8))?
- 18Iterating through a list using a while loop requires quite a lot of code, so Python provides the for loop as a shortcut that accomplishes the same thing.words = ["hello", "world", "spam", "eggs"]
for word in words:
print(word + "!")
Information
- Description
- Flashcards on Python, created by Андрей Бармалей on 18/02/2019.
- Created by
- Андрей Бармалей
- Views
- 0
- Rating