麻烦Python用户名和密码应用程序

时间:2013-11-28 19:19:25

标签: python

我正在尝试使用python为我的软件设计类的项目制作类似电子邮件的应用程序。我对此仍然很陌生,所以如果这很难理解,我会事先道歉。

我想创建一个程序,您可以使用现有的用户名/密码登录或创建新的用户名/密码。我似乎无法让程序与现有用户一起登录,或者创建一个新程序。我认为我遇到的问题是密码部分。该程序识别现有的用户名,但循环回到第一个语句“你是注册用户吗?是/按?按q退出”

我确信这里有很多错误,因为我对Python还不是很好。任何帮助是极大的赞赏。谢谢!

users = {}
users["nkk202"] = "konrad"

choice = None
login = None
createPassword = None
createUser = None
createLogin = None




print("Welcome to Kmail. The most trusted name in electronic mail.")
print("\nLet's get started")

while choice != "q":
    choice = input("Are you a registered user? y/n? Press q to quit: ")

    if choice == "q":
        print("Thank you for using Kmail. Goodbye.")

    if choice == "n":
        print("Okay then, let's set up an account for you then.")
        createUser = input("Create login name: ")

        if createUser in users:
             print("I'm sorry, that username is already in use. Please try another!\n")
        else:
             createPassword = input("Enter a password: ")


    elif choice == "y":
        login = input("Enter your username: ")

        if login in users:
           password = input("Enter your password: ")

           if password in users:
               print("Welcome", user, "!")

        else:
            print
            print("I'm sorry, either the password/username was unaccaptable, or does not exist. Please try again. \n")

0 个答案:

没有答案