← 2023 questions

2023 / NETFLIX / QUESTION 27

Movie search

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

THE QUESTION

The file provided in the question contains a list of movies. Charlotte would want to search for a film in which it has the word “space” in the title. Write a code that takes a string as an input and returns a list of films which contains the word that has been inputted, if there is no equivalent film return “No result found”

(Explore opening and reading text files)

Question by Phuong Nghi. Source: Girls In Code SEA — Behind the Screens, 2023, slide 45.

CHECK YOUR ANSWER

Try your answer.

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

Search for the whole word space, case-insensitively, in the supplied file. Include years. Enter one matching film per line or a list; any order is accepted.

Reveal worked answer

Space films · one valid answer

["2001: A Space Odyssey (1968)", "Destiny in Space (1994)", "Invasion of the Space Lobsters (2006)", "It Came From Outer Space (1953)", "Office Space (1999)", "Plan 9 From Outer Space (1958)", "Space Station (2002)", "Teenagers from Outer Space (1959)"]

Read the file line by line and select titles matching the whole word “space”, ignoring case.