입력 한 후에 오류가 발생합니다. 어떻게 해결할 수 있습니까?이 3 줄의 파이썬 코드에 무슨 문제가 있습니까?
print('Type ROLL to roll for your stats')
roll = input()
if roll == ROLL:
# ...
입력 한 후에 오류가 발생합니다. 어떻게 해결할 수 있습니까?이 3 줄의 파이썬 코드에 무슨 문제가 있습니까?
print('Type ROLL to roll for your stats')
roll = input()
if roll == ROLL:
# ...
오류에 대해 더 자세히 설명 했어야합니다. 어쨌든 코드를 보면 들여 쓰기 오류가 분명합니다. if
문은 들여 쓰기가되지 않아야하며 이전 문과 동일한 수준이어야합니다. // 문서 : 또 다른 오류가 비교 문자열이 'ROLL'
print('Type ROLL to roll for your stats')
roll = input()
if roll == 'ROLL':
.......
roll = input ('Type ROLL to roll for your stats ') # input block can contain a string to display
if roll == "ROLL": # This wasn't a string so Python3 will look for a variable named ROLL, which it won't find
을 의미 가정합니다. python.org/py3k/tutorial/) ... – JBernardo
어떤 오류가 발생합니까? –
내 오류는 ... 트레이스 백 (most revent call last) :에있는 파일 "pyshell # o>"1 번째 줄 rollNameError : 이름 'roll'이 (가) 정의되지 않았습니다. –