Set, dictionary, map and filter quizes
What do these lines print?
>>> for i in ["Hello", "Holberton", "School", 98]:
>>> print(i, end=" ")
- Hello Holberton School 98
- 0 1 2 3
- 1 2 3 4
What do these lines print?
>>> a = { 'id': 89, 'name': "John", 'projects': [1, 2, 3, 4] }
>>> a.get('projects')
- [1]
- 'projects'
- 1 2 3 4
- Nothing
- list
What do these lines print?
>>> for i in range(0, 3):
>>> print(i, end=" ")
- 0 1 2
- 1 2 3
- 0 1 2 3
What do these lines print?
>>> a = { 'id': 89, 'name': "John", 'projects': [1, 2, 3, 4], 'friends': [ { 'id': 82, 'name': "Bob" }, { 'id': 83, 'name': "Amy" } ] }
>>> a.get('friends')[-1].get("name")
- Amy
- 89
- [ { ‘id’: 82, ‘name’: “Bob” }, { ‘id’: 83, ‘name’: “Amy” } ]
- Nothing
- Bob
What do these lines print?
>>> a = { 'id': 89, 'name': "John" }
>>> a.get('id')
- a['id']
- id
- 'id'
- John
- 89
What do these lines print?
>>> a = { 'id': 89, 'name': "John" }
>>> a.get('age')
- 89
- age
- Not found
- Nothing
- 12
What do these lines print?
>>> a = { 'id': 89, 'name': "John" }
>>> a['id']
- a['id']
- id
- 'id'
- John
- 89
What do these lines print?
>>> for i in [1, 3, 4, 2]:
>>> print(i, end=" ")
- 1 2 3 4
- 0 1 2 3
- 1 2 3 4
- 1 2 4 3 0
What do these lines print?
>>> for i in [1, 2, 3, 4]:
>>> print(i, end=" ")
- 1 2 3
- 0 1 2 3
- 0 1 2 3 5
- 1 2 3 4
What do these lines print?
>>> a = { 'id': 89, 'name': "John", 'projects': [1, 2, 3, 4] }
>>> a.get('projects')[3]
- 1 2 3 4
- 4
- [4]
- [3]
- 3
What do these line print?
>>> for i in range(1, 4):
>>> print(i, end=" ")
- 1 2 3 4
- 1 2 3
- 0 1 2 3
What do these lines print?
>>> a = { 'id': 89, 'name': "John" }
>>> a.get('age', 0)
- 0
- 'age'
- Nothing
- 89
