正如许多人猜测的那样,我很擅长这一点;我上周才开始,因此我解决问题的能力很小 . 我正在尝试制作一款饮用游戏,用户可以在不同的难度级别之间进行选择,并且遇到了我的 Headers 中引用的问题 . 这是我的代码,但我不知道我做错了什么 .
Blacked = 0
def Blacked():
global Blacked
print('Time to see if you have luck on your side\n')
import random
b=random.randint(0,100)
print(b)
if b<50:
print(names_of_players[-1],'and those to the right and left drink')
elif b>50:
print(names_of_players[0], 'and those to the right and left drink')
print('Jepordy!, If your name is printed please finish your drink')
import random
print=(random.choice(names_of_players))
Medium=1
def Medium():
global Medium
print('d')
def Easy():
Easy = 2
global Easy
print('f')
print('Which mode do you want to choose: \n press 0 for Blacked \n press 1 for Medium \n press 2 for Easy"')
x=int(input())
if x==0:
Blacked()
elif x==1:
Medium()
elif x==2:
Easy()
else:
print('Please enter valid entry')
1 回答
你应该改变这个:
进入这个:
为了修复错误
"local variable 'print' referenced before assignment"