擅长:python、mysql、java
<p>只要改变一下:</p>
<p><code>elif limit >= 2:</code></p>
<pre class="lang-py prettyprint-override"><code>secret = "Meow"
guess = ""
limit = 1
while guess != secret and limit <= 5:
if limit == 2:
print("You have 4 guesses left!")
elif limit == 3:
print("You have 3 guesses left!")
elif limit == 4:
print("You have 2 guesses left!")
elif limit == 5:
print("You have 1 guess left!")
if limit == 1:
guess = input("What's the secret? OwO You have 5 guesses. ")
elif limit >= 2:
guess = input("What's the secret? OwO. ")
limit += 1
print("You cheated! Or lost.")
</code></pre>