← 2023 questions

2023 / NETFLIX / QUESTION 28

Surprise me

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

THE QUESTION

Charlotte is struggling to pick a movie to watch on Netflix. Import the .txt file of movies below and convert it into a list, to create a “Surprise me” function that randomly selects a movie for her to watch.

(Hint: import random)

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

PRACTICE CHECK

Try your answer.

Checks membership of the output, not randomness.

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.

Submit one randomly chosen movie title from the supplied surprise-movie file.

Reveal worked answer

Surprise selection · one valid answer

The Godfather

Split this file on commas, then call random.choice on the titles. Any listed title is accepted.