在线上冒号之后我得到'预期的一个识别块':def StartGame(用户名):对于线路的其余部分它是upp red,并且是编程的新手我不确定我做错了什么.谢谢你提前:)
def StartGame(username):
print("This game is all about Trading and Adventuring.")
time.sleep(0.51)
print("This is what is in your inventory: %s" % Inventory)
time.sleep(1)
print("As you go around, you will start to lose hunger. You will need to buy food along the way.")
time.sleep(1)
print("You have %s Health Points (HP)" % UserHunger)
TO.SetRandName()
Run Code Online (Sandbox Code Playgroud)
看起来你正在混合标签和空格.使用4个空格进行缩进:
def StartGame(username):
print("This game is all about Trading and Adventuring.")
time.sleep(0.51)
print("This is what is in your inventory: %s" % Inventory)
time.sleep(1)
print("As you go around, you will start to lose hunger. You will need to buy food along the way.")
time.sleep(1)
print("You have %s Health Points (HP)" % UserHunger)
TO.SetRandName()
Run Code Online (Sandbox Code Playgroud)
另见PEP-8缩进段落.
| 归档时间: |
|
| 查看次数: |
603 次 |
| 最近记录: |