← 2023 questions

2023 / NETFLIX / QUESTION 29

Movie marathon

Try the question in your own editor, then check your output below.

THE QUESTION

After a tiring week, Charlotte wants to have a movie marathon from the movies that she’s added to her list on Netflix. Below shows Charlotte's list of movies, help her choose the movies by randomly choosing movies from her list below that sums up to the duration she wants her movie marathon to be. Use 6 hours and 24 hours as inputs, remember to screenshot both test cases.

Starter Code:

My_list = [{"Movie": "The Incantation", "Duration":2},
{"Movie":"The Invitation", "Duration": 2},
{"Movie":"The School for good and evil", "Duration": 2},
{"Movie":"Spirited Away", "Duration": 2},
{"Movie":"Your Name", "Duration": 2},
{"Movie":"Enola Holmes", "Duration": 2},
{"Movie":"A Silent Voice", "Duration": 2},
{"Movie":"The Tale of Princess Kaguya", "Duration": 2},
{"Movie":"Corpse Bride", "Duration": 1},
{"Movie":"Pitch Perfect 2", "Duration": 2}]

Question by Natalie. Source: Girls In Code SEA — Behind the Screens, 2023, slide 47.

PRACTICE CHECK

Try your answer.

Practice convention: films cannot repeat; the original question did not specify this.

Run your program in your own editor, then paste its output below. This checks the stated output or checkpoint; it does not assess your full program. Practice attempts do not affect competition scores.

Without repeating movies, enter any three 2-hour titles from My_list as a list or one per line.

Using each film at most once, enter possible or impossible.

Reveal worked answer

6-hour marathon · one valid answer

["The Incantation", "The Invitation", "The School for good and evil"]

24-hour marathon

impossible

Any three of the nine 2-hour films total 6 hours. All ten films together last 19 hours, so 24 hours is impossible without repeats.