- Fork and Clone
Create a main.py
and test your code with python3 main.py
.
- Create a list named
students
containing some student names (strings). - Print out the second student's name.
- Print out the last student's name.
- Create a tuple named
foods
containing the same number of foods (strings) as there are names in thestudents
list. - Use a
for
loop to print out the string "food goes here is a good food".
- Using a
for
loop, print just the last two food strings fromfoods
.
- Create a dictionary named
home_town
containing the keys ofcity
,state
andpopulation
. - Print a string with this format:
"I was born in city, state - population of population"
- Iterate over the key: value pairs in
home_town
and print a string for each item, for example:
"city = Arcadia"
"state = California"
"population = 58000"
-
Create an empty list named
cohort
. -
Using a
for
loop, add one dictionary to thecohort
list for each student name. Each dictionary should have this shape:{ 'student': 'Tina', 'fav_food' 'Cheeseburger' }
-
Iterate over
cohort
printing out each element.
- Using the list of
students
and list comprehension, assign to a variable namedawesome_students
a new list containing strings similar to this:["Tina is awesome!", "Fred is awesome!", "Wilma is awesome!"]
- Iterate over
awesome_students
printing out each string.
- Using the tuple
foods
and list comprehension within afor
loop, print each food string that contains the lettera
.