0
我想在python中發出一個命令,我要求用戶輸入正確的哥哥年齡。如果進入23歲,該方案終止說「好工作」。否則,用戶再次被問到我兄弟的年齡。我無法理解如何製作這樣的節目。下面是我最好的猜測:python關於循環中的年齡的命令,直到出現正確的答案
age = input("what is the age of your brother? ")
while age = 23:
print ("correct answer entered")
else:
print ("incorrect answer entered")
我得到一個語法錯誤
'='用於賦值,'=='用於比較。 – Barmar
你需要問循環中的新時代。它應該是'年齡= 23:' – Barmar