-2

I have looked over the answers given on other questions. But they are not making any sense to me sorry. I have a notepad document that I want to check to see if the name that you give the program is in the document and if it is. it says hello and let you access the program and lets you do stuff. If your name is not it the program I want it to say that you do not have an account and ask you if you want to make an account and if you say yes then you give it your name and it adds it to the text document. The problem that I am having is that it does not see if your name is in the text document but when you print the names it gives you them and they look like this. 'Coryn\n' and I have no clue what this means. My code is down below.

def AI():
    name = raw_input("Hello my name is Cora I am an artificial helper. What is your name? ")
    yes1 = ""
    name_list = list(open('r','\\\\ph-fss1\\Students\\S39055\\Desktop\\names.txt'))
    for names in name_list:
        if name in name_list:
            print "Welcome back sir"
        else:
            yes1 = raw_input("You do not have an account do you wish to make one? yes/no ").lower()
        if yes1 == "no":
            break
        if yes1 == "yes":
            name('w',open('\\\\ph-fss1\\Students\\S39055\\Desktop\\names.txt'))  

1 Answers1

1

You need to split the lines to make them 'readable' for the AI. str.splitlines Docs

dom_ahdigital
  • 1,651
  • 18
  • 37