こんにちは私はこのコードを書いていますが、何が間違っているのか分かりません。ユーザー名が間違っていると言います。ユーザ名を正しく入力するとアクセスが拒否されたと言われるのはなぜですか?
ea = input("Do you already have an account")
if ea == "Yes" or ea == "yes":
Ausername = input("Input your username")
Apassword = input("Input your password")
f=open("login.txt","r")
lines=f.readlines()
username=lines[0]
if (Ausername) == (username):
print("Welcome to the quiz")
else:
print("Access denied")
f.close()
else:
name = input("Input your name")
yeargroup = input("Input your year group")
age = str(input("Input your age"))
firstusername = ((name[0]+name[1]+name[2])+(age))
print((firstusername)+(" is your username"))
firstpassword = input("Enter what you want your password to be")
print(firstusername)
print(firstpassword)
login = open("login.txt","a")
login.write(firstusername + "\n" + name + "\n" + yeargroup + "\n" + age + "\n" + firstpassword + "\n")
login.close()
print("---------------------------------------------------")
:あなたは大文字小文字を区別しない比較を行いたい場合
また、あなたはあなたの探索空間のサイズを小さくするために
str.lower
を使用して小文字にあなたの文字列を変換する必要があります?期待される出力は何か、また、エラートレースバックを投稿してください。 – rkatkam