13.8. Chapter Assessment¶
Create a tuple called olympics
with four elements: “Beijing”, “London”, “Rio”, “Tokyo”.
The list below, tuples_lst
, is a list of tuples. Create a list of the second elements of each tuple and assign this list to the variable country
.
With only one line of code, assign the variables city
, country
, and year
to the values of the tuple olymp
.
Define a function called info
with five parameters: name, gender, age, bday_month, and hometown. The function should then return a tuple with all five parameters in that order.
Given is the dictionary, gold
, which shows the country and the number of gold medals they have earned so far in the 2016 Olympics. Create a list, num_medals
, that contains only the number of medals for each country. You must use the .items() method. Note: The .items() method provides a list of tuples. Do not use .keys() method.