Answered You can hire a professional tutor to get the answer.
Given the following list: ['Serena Williams', 'Vanessa Williams', 'john McEnroe', 'rafael Nadal'] The contents of key_sort is given by: key_sort =...
Given the following list:
['Serena Williams', 'Vanessa Williams', 'john McEnroe', 'rafael Nadal']
The contents of key_sort is given by:
key_sort = sorted(names, key=str.lower)
The elements of key_sort will be _________:
a
['Serena Williams', 'Vanessa Williams', 'john McEnroe', 'rafael Nadal']
b
['john McEnroe', 'rafael Nadal', 'Serena Williams', 'Vanessa Williams']
c
['john','rafael','serena','vanessa']
d
['john McEnroe', 'rafael Nadal', 'Serena Williams', 'Vanessa Williams']
Complete the following code snippet so that all of the negative values my_dict will be changed to zero.
for key, value in _______:
if value < 0:
my_dict[key] = 0
a
my_dict.values()
b
my_dict[keys]
c
my_dict
d
my_dict.items()
What are the contents of list b?
>>> a = [1,2,3,4,5]
>>> b = [-2*x for x in a]
a
[2,4,6,8,10]
b
[1,2,3,4,5]
c
[-2,-4,-6,-8,-10]
d
[-2,-4]
Given the list nums = [[10, 20, 30], [98, 99]], what does nums[1][1] evaluate to?
a
30
b
99
c
98
d
[[98,99]]
Assume that my_dict has the following entries: my_dict = dict(bananas=1.59, fries=2.39, burger=3.50, sandwich=2.99). What is the output of the following code segment?
my_dict.update(dict(soda=1.49, burger=3.69))
burger_price = my_dict.get('burger', 0)
print(burger_price)
a
1.49
b
3.50
c
3.69
d
2.99
A(n) ___________ method initializes a class.
a
__init__
b
initialization
c
dictionary
d
constructor
What is the output of the following statement: list('123')?
a
[123]
b
['123']
c
'123'
d
['1','2','3']
What is the output of the following code snippet?
solar_distances = dict(mars=219.7e6, venus=116.4e6, jupiter=546e6, pluto=2.95e9)
list_of_distances = list(solar_distances.values()) # Convert view to list
closest = sorted(list_of_distances)[0]
next_closest = sorted(list_of_distances)[1]
print('%.4e' % next_closest)
a
219.7e+06
b
116.4e+06
c
2.1970e+08
d
116.4e+08
What is the output of the following code snippet?
>>> a = [1,2,3,4]
>>> sum([x*x for x in a])
a
[1,4,9,16]
b
14
c
program error
d
30
Assume that my_dict has the following entries: my_dict = dict(bananas=1.59, fries=2.39, burger=3.50, sandwich=2.99). What is the output of the following code segment?
my_dict['burger'] = my_dict['sandwich']
val = my_dict.pop('sandwich')
print(my_dict['burger'])
a
1.49
b
3.50
c
3.69
d
2.99