我在行上冒号后得到'预期的一个标识块':def StartGame(username): 对于其余部分来说,它是红色的,并且是编程的新手,我不确定我做错了什么。谢谢你提前:))
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()
答案 0 :(得分:5)
看起来你正在混合制表符和空格。使用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()