所以,我想提出一個密碼系統。 它要求用戶輸入密碼,然後檢查它是否正確。我遇到以下錯誤:
%Run HelloPython.py
File "/home/pi/Python Coding/HelloPython.py", line 17
print('Welcome home,', name,)
^
SyntaxError: expected an indented block
有些錯誤。 代碼:
print('What is your name?')
# Stores everything typed up until ENTER
name = sys.stdin.readline()
print('Hello', name,'Enter password.')
password = sys.stdin.readline()
if password == ("1"):
print('Welcome home,', name,)
else:
print("Password:", password,"Is incorect. Please try again.")
您正在比較一個字符串與數字 –
那麼我該怎麼做? – Firework
@aaron我如何關閉這個問題? – Firework