dimanche 14 juin 2020

Python if statement doesnt open file

So i looked over a lot of places to my extent of getting annoyed for not finding a reason why this happens. So i have this:

#Aks if you are new
def info():
    newuser = input('Are you new to this program? Y/n: ')

    #if yes, opens nwusr file
    if newuser in {'Y', 'y'}:
       os.system('clear')
       os.system('python3 newuser.py')
info()

When I press "Y" or "y" and hit enter, It goes straight down to:

#if not, continues cause you aint no scrub
def addacc():
    #code blah blah stuff
addacc()

(updated code)The problem is when I input Y or y it doesnt input 'python3 newuser.py', it just executes addacc(). Which is not what I want.

Aucun commentaire:

Enregistrer un commentaire