1. What will the following python code display?
num = list(range(5))
print(num)
2.
Answer the following...
1. What will the following python code display?
num = list(range(5))
print(num)
2.
Answer the following questions using the list below. You can
record your answers in the essay textbox.
data = [5,3,7]
A. Write code to replace the value in the 0 position with the
number 8.
B. Add the value 10 to the end of the list.
C. Insert the value 22 after position 1 in the list.
D. Remove the value at position 2.
E. Sort the...
write a python program that include a function named
activity_selection() and take in two arguments, first...
write a python program that include a function named
activity_selection() and take in two arguments, first one would be
the number of tasks and the second argument would be a list of
activities. Each activity would have an activity number, start time
and finish time.
Example activity_selection input and output:
activity_selection (11, [[1, 1, 4 ], [2, 3, 5], [3, 0, 6], [4,
5, 7], [5, 3, 9], [6, 5, 9],[7, 6, 10], [ 8, 8, 11], [ 9, 8,...
Write a Python function count_bigger that takes two parameters,
a nested list of objects and a...
Write a Python function count_bigger that takes two parameters,
a nested list of objects and a threshold number. It returns an
integer specifying how many of the objects anywhere in the nested
list are numbers that are larger than the threshold. (For our
purposes, "numbers" are either integers or floats.) There may be
objects in the list other than numbers, in which case you would
simply ignore them. Here are a couple of examples of how the
function should behave...
(Python 3) If I have a list of keys and 3 lists of values, how
can...
(Python 3) If I have a list of keys and 3 lists of values, how
can I append these values into an existing key, value pair in a
dictionary? Say I have:
mykeys = ["John", "Sarah", "Lexi, "Cass"]
values1 = [3, 5, 2, 6]
values2 = [17, 18, 12, 21]
values3 = [4, 7, 3, 0]
How can I make it so my dictionary contains all three values in
each of the keys. i.e.:
{"John" : [3, 17, 4], "Sarah":...
Write a function count_div5(nested_list) that takes in a
list of lists of integers, and returns a...
Write a function count_div5(nested_list) that takes in a
list of lists of integers, and returns a list of integers
representing how many integers in each sublist of the original were
divisible by 5.
Examples:
>>> count_div5([[5, 3, 25, 4], [46, 7], [5, 10,
15]])
[2, 0, 3]
>>> count_div5([])
[]
>>> count_div5([[-20, 10, 2, 4, 5], [], [5],
[8, 25, 10], [6]])
[3, 0, 1, 2, 0]