Question
Ok, so I'm writing the HTML for a web app that takes a list of movies and randomly selects one from the list. First part
Ok, so I'm writing the HTML for a web app that takes a list of movies and randomly selects one from the list.
First part of the page displays "Movie of the day" and then displays the name of the movie (which I have done correctly). Now the problem is to get the second part of the web app, directly underneath the first part, to display "Tomorrow's movie" and generate another random movie from the list. The code shown in the picture is what I initially thought what was correct. ALL OF THIS IS WRITTEN UNDER THE INDEX FUNCTION. USING PYTHON AS WELL!
I know it's incorrect, and i just need help to get the code correct. Thanks in advance.
1 from flask import Flask 2| import random app Flask(-name-) 6 app.configl'DEBUG'] True # displays runt ime errors in the browser, too 8 Gapp.route("") 10 def index(): # choose a movie by invoking our new function movie get_random_movie) 12 13 14 15 16 17 18 19 20 # build the response string content "1>Movie of the Day" content "ul>" content"Tomorrow's movie += "" movie +-"cli>" + movie movie "
" Movie
" 23 24 25 26 27 28 29 30 31 32 + " return movie get-random, movie(): movies ['The Thing','Prometheus', 'Childs Play', 'Moon', '28 Days Later'] random_movie random.choice(movies) return random_movie def 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