Question
Exercise 1. Write a program that does the following: (Python) Create a list with the exact following elements: (You could first create a string with
Exercise 1. Write a program that does the following: (Python)
-
Create a list with the exact following elements: (You could first create a string with all the movies' names below, then use split(', ') to create a list -- notice that I use ', ' with a space after the comma)
black panther, bohemian rhapsody, the favourite, green book, roma, a star is born, vice, can you ever forgive me?, the favourite, first reformed, green book, roma, vice, if beale street could talk, a star is born, incredibles 2, isle of dogs, mirai, ralph breaks the internet, spider-man: into the spider-verse, cold war, the favourite, never look away, roma, a star is born, the ballad of buster scruggs, black panther, the favourite, mary poppins returns, mary queen of scots, avengers: infinity war, christopher robin, first man, ready player one, solo: a star wars story, black panther, bohemian rhapsody, first man, a quiet place, roma, animal behaviour, bao, late afternoon, one small step, weekends, free solo, hale county this morning, this evening, minding the gap, of fathers and sons, rbg, black sheep, end game, lifeboat, a night at the garden, period. end of sentence., the favourite, mary poppins returns, mary queen of scots, avengers: infinity war, christopher robin, first man, ready player one
-
Remove duplicated names from the list
-
Sort the names of the movies in the list in alphabetical order
-
Modify the elements of the list so that all movies' names are in title case with the following restrictions:
- First letter of each word is capitalized,
- Except for the words the, a/an, of, at, on, in -- these should stay all lowercases,
- But if these words are the first word in the name of any movie, then their first letter should be capitalized
The output of the program should be a list with all the movies' names (no duplicates), listed in alphabetical order and formatted in title case, with the restrictions listed in number 4.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started