Exercise for reference: 

Create a web app with Flask that lets the user submit a username and a password. The app then checks if the username exists in a text file, and it also checks if the password contains at least one number, one uppercase letter, and it is at least 5 characters long.

Answer: 

Please find the code attached in the resources tab. 

Explanation:

We have two while loops here, which we got from exercise 81. The difference is instead of getting input through an input function; we're getting input from the html form with usr = request.form['username'] . If that user exists in the text file, we insert the message "Username exists" in the HTML page, and we render the HTML form again. The same goes for the password.