Dolokelen INFO 301 Study Questions
Dolokelen INFO 301 Study Questions
1. Which data type is used to store multiple values in a single variable in Python?
a. int
b. list
c. float
c. set()
30. What will be the result of my_dict = {1: 'a', 2: 'b'}; my_dict[3]?
a. 'c'
b. None
c. KeyError
32. Which method can be used to remove the last item from a list in Python?
a. remove()
b. delete()
c. pop()
36. Which of the following is the correct syntax for list comprehension?
a. [x for x in my_list]
b. {x for x in my_list}
c. map(lambda x: x, my_list)
38. Which of the following functions is used to find the length of a string in Python?
a. length()
b. size()
c. len()