擅长:python、mysql、java
<p>编辑:简化您的检查以打印输入的正确性</p>
<p>试试这个:</p>
<pre><code>import time
import re
print("Welcome to the memory game.")
print("Choose difficulty level :")
print("1. Easy")
print("2. Medium")
print("3. Hard")
print("4. Very Hard")
x = input("press '1' for easy, '2' for medium, '3' for hard and '4' for very hard : ")
if x == '1' :
print("You chose level 1, easy.")
print("I will give you 3 objects and you have to type then in the correct order to gain points.")
print("Not cAsE SeNSitIvE")
text = "Ship, Money, Python"
obj = print(text, end="\r")
time.sleep(5)
print(" " * len(text))
ez = str(input()).upper()
if re.match(r"SHIP\s*,\s*MONEY\s*,\s*PYTHON", ez):
print("Correct")
else :
print("Wrong")
print("The answer was : Ship, Money, Python")
</code></pre>