09-17
-
(
overlap
) Given two lists of numbers, produce a sorted list of elements common to both of them.overlap [10, 20, 17, 30, 15, 18] [18, 30, 5, 17, 21, 90] == [17, 18, 30]
-
Turn the following table into a dictionary called
q2
:
Combo | Effectiveness |
---|---|
(‘Fire’,‘Fire’) | 0.5 |
(‘Fire’,‘Water’) | 0.5 |
(‘Fire’,‘Grass’) | 2.0 |
(‘Grass’,‘Fire’) | 0.5 |
(‘Ground’,‘Fly’) | 0.0 |
-
The rules changed, fire types have normal effectiveness against each other. Remove the
('Fire','Fire')
entry from theq2
table. -
Use
items()
to print the table using the data fromq2
. -
Make a list of 8 foods. Use
enumerate
to print out a the foods in order with one more “.” in front of each food. Small example output:apple .orange ..banana ...grape ....pineapple
-
(
countWords
) Write a function that counts the occurences of each word in the input string. It produces a dictionary where the keys are the words and the values are the counts. -
(
sort2
) Given a list of ordered pairs (x,y), sort them in descending order based on the second coordinate (y).
Problems
Everyone does the first one. If you want to skip the questions above, do the second one.
-
USACO 2019 January Bronze 2: sleepy cow sorting.
-
USACO 2019 January Bronze 3: guess the animal.