擅长:python、mysql、java
<p>您应该使用While循环。
例如,(*确保添加中断)</p>
<pre class="lang-py prettyprint-override"><code>while True:
print("foo")
</code></pre>
<p>您试图完成的任务可以通过以下代码完成:</p>
<pre class="lang-py prettyprint-override"><code>joesPassword
while True:
continueLoop = input("Hey! Want to continue (Y/n)")
if continueLoop=="n":
break
user = input("Welcome! What is your username? ")
passw = input("Hello, "+user+"! What is your password? ")
if passw==joesPassword:
print("Hey, Joe! You got your password correct!")
else:
print("Aw man! Your password is wrong!")
</code></pre>