My code keeps printing a certain part of the code, instead of continuing with the rest of the program : <p>After I type in any username and password (doesn't matter whether it's correct or not), it keeps printing another part of the code.</p>

<p>The login part works fine but it doesn't show the correct output afterwards. It continuously shows: 
"Incorrect login details entered 
Have you made an account?
Yes or No"</p>

<p>This has stumped both my teacher and I. I have looked at different websites with examples of login/registration systems. I have also tried re-arranging the code differently. </p>

<p>This is the code:</p>

<pre><code>username = input("Please enter your username: ")
password = input("Please enter your password: ")
file = open("Usernames.txt","r")
found = False
for line in file:
    user = line.split(",")
    if user[0] == username and user[1] == password:
        found = True
        print("Username: " + user[0])
        print("~~~~~")
        print("Welcome to the game, " + user[0])
    else:
        found == False
        print("Incorrect login details entered")
        print("Have you made an account?")
        ans = input("Yes or No ")
        while ans not in ("Yes", "No"):
            if ans == "Yes":
                print ("Please sign in again")
                username = input("Please enter your correct username: ")
                password = input("Please enter your correct password: ")
            elif ans == "No":
                print("Would you like to make an account? ")
            else:
                ans = input("Please enter Yes or No ")
</code></pre>

<p>The expected result when the username and password is correct:</p>

<pre><code>Username: Smartic
~~~~~
Welcome to the game, Smartic
</code></pre>

<p>The expected result when the username and password is incorrect:</p>

<pre><code>Incorrect login details entered
Have you made an account?
Yes or No
</code></pre>

<p>The expected result when the user enters <code>Yes</code>:</p>

<pre><code>Please sign in again
Please enter your correct username:
Please enter your correct password:
</code></pre>

<p>The expected result when the user enters <code>No</code>:</p>

<pre><code>Would you like to make an account?
</code></pre>

<p>The expected result when the user enters something other than <code>Yes</code> or <code>No</code>:</p>

<pre><code>Please enter Yes or No 
</code></pre>
