为什么这个错误会在第一行弹出:
名称错误:未定义名称"随机"
correctPath = random.randint(1,2,3)
if chosenPath == str(correctPath):
print("Thank you for your help")
print("this has been altered for creative purposes")
elif chosenPath != str(correctPath):
print("Thanks in advance.")
else:
print ("code to be written")
random.randint(a,b)
函数返回一个随机整数N,使得 a<=N<=b。这意味着您只能使用两个参数,而第三个参数是不必要的。