title: How can I create a text box that uses a python yes/no dialogue text alongside a flask html text box for a website using flask?
body: <p>New to coding and working on a project using flask but have hit a wall.</p>
  <p>I'm trying to create a box that would be in the center of the site screen asking the user the first question. The user would then input yes or no if the input is no it would follow up with the next question until the end of the script.</p>
  <p>I don't know Java yet so I wouldn't know how to translate it over and would really like to try if this way if possible. Any help or direction would be greatly appreciated. Also if there is an exact term for this could you please let me know.</p>
  <p>The following is the python code I am be using:</p>
  <pre><code>from flask import Flask, redirect, url_for, render_template, request, session, flash
  from datetime import timedelta
  import sqlalchemy
  
  app = Flask(__name__)
  app.secret_key = &quot;tops&quot;
  app.permanent_session_lifetime = timedelta(minutes=5)
  
  
  @app.route(&quot;/home&quot;)
  def home():
      yes = &quot;yes&quot;
      no = 'no'
  
  questions = ['Could I please have a cookie?',
               'please?',
               'just one?',
               'what if i never ask for another cookie again?\n.......until tomorrow\n'
               'last chance'
               ]
  
  yeses = [&quot;sure, here you go.&quot;,
           &quot;ok but just half.&quot;,
           &quot;ok sure, but after dinner.&quot;,
           &quot;sure, might have one too.&quot;,
           &quot;why not, it's been a day&quot;]
  
  nos = ['no way',
         &quot;not today honey&quot;,
         &quot;no, you'll spoil your dinner.&quot;,
         &quot;you had 2 yesterday, not today hun&quot;,
         &quot;we're all out, we'll get some at the store later&quot;
         ]
  
  for i, question in enumerate(questions):
    while True:
      # loop until they respond with yes or no
      answer = input(question).lower()
      if answer != yes and answer != no:
        print('answer yes or no please')
        continue  # continue while loop since wasn't yes/no
      break       # discontinue while loop
  
    if answer == yes:
      print(yeses[i])  # output i-th yes response
      break
    else:
      print(nos[i])    # output i-th no response
  else:
    print(&quot;Sorry, you don't get a cookie&quot;)
  </code></pre>