Python - First project user system This code is supposed to be the &quot;user&quot; system for my app. This will ask you what you want to do...
If you want to add a user, remove a user or check the list of saved users.
With this I learned how to open and edit text files. And my goal doing projects is keep on learning and maybe someday I will be able to work or professionally use Python.
This code is working at the moment, but I wanted to know if is too basic or too complicated with some more professional eyes on it (please consider my 3 weeks knowledge).
snames = list()
f_n = (open('names.txt')).read()
print(&quot;Welcome to NAME.app&quot;)
##################    USER   LOGG IN        #######################
while True:
    name = input(&quot;\n - Insert name to logg in \n - ADD to save new user \n - LIST to see saved users \n - REMOVE to delete a user \n - EXIT to finish \n ...&quot;)
    if name.lower() == &quot;add&quot;:
        n_input = input(&quot;Name:&quot;)
        with open('names.txt', 'a') as f:
            f.write(n_input + '\n')
            f.close()
        continue

    elif name.lower() == &quot;list&quot;:
        with open('names.txt') as f:
            print(f.read().splitlines())

    elif name in f_n:
        print(&quot;Logged as&quot;, name.upper())
        nxt = input('Welcome, press enter to continue \n')
        if nxt == '':
            break

    elif name.lower() == 'remove':
        rem = input(&quot;Insert user name to remove \n ...&quot;)
        with open('names.txt', 'r+') as f:
            l=f.readlines()
            l=[z for z in l if rem not in z]
        with open('names.txt', 'w') as f:
            f.writelines(l)


    elif name.lower() == &quot;exit&quot;:
        exit()
First thing I notice is that this...
nxt = input('Welcome, press enter to continue \n')
if nxt == '':
    break

...could just be:
input('Welcome, press enter to continue')

It doesn't seem like you're using nxt for anything else so there's no need to store a value for it, especially if you just want the user to hit enter.

Next, you never do f_n.close() which can cause some issues with the file (e.g., it doesn't save or something weird happens with the garbage collector system, etc.).
You might want to replace...
elif name.lower() == &quot;exit&quot;:
    exit()

...with:
elif name.lower() == &quot;exit&quot;:
    f_n.close()
    exit()

The same should be done with the file in the first elif. Something I also noticed about this is that f_n is the same file as f. You shouldn't need to keep opening it; just use the f_n variable.

Instead of...
if name.lower() == &quot;add&quot;:
    n_input = input(&quot;Name:&quot;)
    with open('names.txt', 'a') as f:
        f.write(n_input + '\n')
        f.close()
    continue

...with:
if name.lower() == &quot;add&quot;:
    n_input = input(&quot;Name:&quot;)
    with open('names.txt', 'a') as f:
        f.write(n_input + '\n')
        f.close()

You don't need to say continue because the rest of the while loop is just elifs.

In terms of overall code style, mostly good, but there are a few things you might want to keep in mind:

Put spaces around equals signs for readability (e.g., use n = 10 instead of n=10).
It's spelled &quot;log&quot; not &quot;logg.&quot;
I don't see a usage of snames, so is it really necessary?
The first comment in your code looks rather odd. Maybe just say # USER LOGIN , use a simple block comment, or, if you have to:

##############
# USER LOGIN #
##############


Hope this helps! If I think of something else, I'll edit it in.