In this lab you will write a Python program that does a little more advanced list manipulation.
This exercise is intended to get you introduced to some of the more powerful ways to work with lists.
Your software file will begin several lists imported from a module "lists". You will need to use list comprehension and list pairing to iterate and edit the data in the lists. There are three different tasks to perform and here are the requirements for each
-
Using the provided list 'school_lunches' from the lists module, your code shall use list comprehension to print out the daily menu, but substitute "bratwurst" everywhere you see "hot dog". Your code shall print the list directly so the output will include the brackets and quotations (['item 1', item 2' ... and so on])
-
Using the provided lists, 'questions" and "answers' from the lists module, your code shall use list pairing (zip) to iterate over the two lists at the same time. Your code shall print out questions and answers in a loop. Format them: "What is your [question]? My [question] is [answer]."
-
Using the provided list 'sports_teams' your code shall manipulate the nested lists to print all teams from New York and then all teams from Los Angeles. Just print the lists directly so the output will include the brackets and quotations (['team 1', team 2' ... and so on])
First, download the project to your local workstation. I recommend using a source code repository interface such as GitHub Desktop. Start with the template file called list_manipulation.py. Modify the header to include your own information, and update the code to meet the requirements. When you are satisfied with your changes, commit them to the repository.
After your code is committed to your GitHub repository, go to your account on GradeScope and find the assignment called Lab-04 - More Lists. Under "Submission Method" select GitHub. You will need to point to the correct repository (called something like joates-223p-spring-2021/lab-04-your user name). You may be asked to link your GitHub account with Gradescope at this time. Next select the Main branch and press Upload. Gradescope will import your project files from GitHub and automatically grade them. If you like what you see, you are done. If not, you can make changes and use the Resumbit button on the bottom right of the Gradescope page to try again.