請問一下要如何在輸入多組密碼後顯示錯誤還是正確~
我打的會輸入一行密碼,下一行顯示錯誤還是正確,請大神幫我看要怎麼修改,謝謝!
https://i.imgur.com/ftaBm5I.png
https://i.imgur.com/a5eVqr5.png
你可能有興趣的文章...
全部留言
while True: code = int(input()) password = 9 if code == password: print('Correct') else: print('Wrong password') 大概像這樣
我不太懂你的意思owo 這樣寫不會出問題嗎 x跟code的值在後面才出現 我用while True是要讓他能一直輸入數字
你要的應該是這樣吧 code=input("請輸入code:") x=input("請輸入密碼:") while True: if(x==code): print("密碼正確") break else: print("密碼錯誤") x=input("請輸入密碼:") https://i.imgur.com/gjHKte9.png