title: Why doesn't the delete button works fine ? need help in python and flask
body: <pre><code>from flask import Flask,session,render_template,request,session
  from flask_session import Session
  
  app = Flask(__name__)
  
  app.config["SESSION_PERMANENT"] = False
  app.config["SESSION_TYPE"] = "filesystem"
  Session(app)
  </code></pre>
  
  <p><strong>Setting notes to an empty array:</strong></p>
  
  <pre><code>notes = []
  
  @app.route("/", methods = ["GET" , "POST"])
   #this is the function for submit button
  def index():
  
  if request.method == "POST:
      note = request.form.get("note")
  
  
      notes.append(note)
  </code></pre>
  
  <p><strong>Note is getting the HTML value of note, and then notes is appending to note:</strong></p>
  
  <pre><code>return render_template("index.html",notes = notes)
  
  @app.route("/",methods =["GET","POST"])
  #this is the function for delete function
  def delete():
   if request.method =="POST":
      number = request.form.get("number")
      notes.remove(notes[number])
   return render_template("index.html" , notes = notes)
  </code></pre>
  
  <p>I am creating a form which accepts or note down which I input as a text in the form section which has a function index.</p>
  
  <p>The other function is for the delete button. It also has a form in HTML with only numbers can be input.</p>
  
  <p>If I choose number 1, then it must delete the first item in the list but it's not happening here.</p>
  
  <p><strong>HTML section is given below:</strong></p>
  
  <pre><code>      &lt;!DOCTYPE html&gt;
         &lt;html&gt;
         &lt;head&gt;
          &lt;title&gt;Hello world&lt;/title&gt;
         &lt;/head&gt;
         &lt;body&gt;
         &lt;h1&gt;Notebook&lt;/h1&gt;
  
    &lt;form action="{{url_for('index')}}" method="POST"&gt;
    &lt;input type="text" name="note" placeholder="Enter the input"&gt;
    &lt;button&gt; Submit &lt;/button&gt;
  
   &lt;/form&gt;
   &lt;form action = "{{url_for('delete')}}" method="POST"&gt;
   &lt;input type="number" name="number"&gt;
   &lt;button&gt;Delete&lt;/button&gt;
   &lt;/form&gt;
   &lt;ul&gt; {%for note in notes%}
   &lt;li&gt;{{note}}&lt;/li&gt;
  {%endfor%}
  &lt;/ul&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  }
  </code></pre>