0
def homeScreenArt():
    print("-*----------*------------*------*------*-")
    print("-----*-------------*--------------*------")
    print("-----&&&&&--&&--&&----&&----&&&&&--------")
    print("-*--&&---&&---&&--&&-*--&&---*--&----*---")
    print("-----&&&--&&----&&--&&----&&----&--------")
    print("-------&&&&&&-*----&&&&--*--&&--&&&&&----")
    print("----*-------&&--------*----------*-----*-")
    print("-------------&&--&--------*--------------")
    print("--*------------&-&--*--------*-------*---")
    print("----------*-----&-------Jack-Carter-2018-")
    print("-----*------------*--------------*-------\n")
def createLogin():
    criteriaMet=0
    print("\n"*60,"-NEW USER-\n")
    firstname=input("input your first name: ")
    age=input("input your age: ")
    #returns error message when a name with len < 3 is entered
    username=(firstname[0]+firstname[1]+firstname[2]+age)
    print("your username is",username)
    while criteriaMet<1:
        passEntered = input("input a password at least 7 characters long: ")
        if (len(passEntered))<7:
            print("password entered is",7-(len(passEntered))," characters to short")
            passEntered=input("input a password at least 7 characters long: ")
            print("password entered is",7-(len(passEntered))," characters to short")
        else:
            criteriaMet=+1
            criteriaMet2=0
            textFile=open(username, "w+")
            textFile.write("username:\n")
            textFile.write(username)
            textFile.write("\npassword:\n")
            textFile.write(passEntered)
            print("user details have been saved to '",username,"'")
            while criteriaMet2<1:
                showCreds=input("Display user credentials? [y/n]")
                if showCreds=="y":
                    criteriaMet2=+1
                    print(textFile.read())
                    textFile.close()
                    print("if functional")
                elif showCreds=="n":
                    criteriaMet2=+1
                    #quizMenu()
                    print("elif functional")
                else:
                    print("Input invalid")
                    print("else functional")
def menu1():
    selection1=input("\n1.Login\n2.New user\n\n\n\n\n\n\n>>> ")
    if selection1=="1":
        login()
    elif selection1=="2":
        createLogin()
    else:
        print("\ninvalid command")
        menu1()
homeScreenArt()
menu1()

everything works up to when it asks the user if they want to view the contents of the text file which contains their user-specific credentials, i've added the call the print "x functional" where x is either if, elif or else to show whether those functions are working properly and its returning the string that says its functional so that all works and yet it won't print the contents of the text file, which i have checked actually has text in it(it does)

ps i dont get any error messages just a blank line and then the "x functional" string

Jack Carter
  • 47
  • 1
  • 8
  • could you please ellaborate – Jack Carter Mar 18 '18 at 17:50
  • Welcome to Stack Overflow! You can learn [How to Ask a good question](http://stackoverflow.com/help/how-to-ask) and create a [Minimal, Complete, and Verifiable](http://stackoverflow.com/help/mcve) example. That makes it easier for us to help you. – Stephen Rauch Mar 18 '18 at 17:50
  • 1
    Last sentence in the accepted answer: _"Note the f.seek(0) -- if you forget this, the f.read() call will try to read from the end of the file, and will return an empty string."_ – Aran-Fey Mar 18 '18 at 17:50
  • ah. thanks, i didn't know .seek() was a thing – Jack Carter Mar 18 '18 at 18:03

0 Answers0