제 질문이 정말로 구체적이지 않거나 제목이 오도 된 것이라면 미안합니다. 파이썬 2.7에서 게임을 만들려고 노력했습니다. 지금까지 모든 것이 잘되고 있지만 한 가지 문제가 있습니다. 구문 오류가 발생하고이를 해결하는 방법을 모르겠습니다. 오류 메시지 : "프로그램에 오류가 있습니다 : * 리터럴 (텍스트 game.py, 28 행)에 할당 할 수 없습니다." 이 줄에서 'n'은 1의 값을 할당하려고합니다. 나는 따옴표와 작은 따옴표하지만 어떤 도움이나 조언은 감사도 작업 밖으로 그것을 시도했습니다이 코드의 문제점은 무엇입니까? (Python, syntax error)
print """
---------------------------------------------
| |
| TEXT GAME: THE BEGINNING! |
| |
---------------------------------------------
"""
print "What is your name adventurer?"
adv_name = raw_input("Please enter a name: ")
print "Welcome " + adv_name + ", I am called Colosso. I am the great hero of the town Isern. \nWhile I was protecting the surrounding forests I was attacked and killed. \nNow I am nothing but a mere spirit stuck in the realm of Life. \nI am here because I swore to slay the corrupt great king Blupri. \nBlupri still lives therefore I cannot travel to the realm of Death. \nI need you to slay him and his minions so I may rest in peace"
print """Do you want to help Colosso?:
1.) Yes (Start playing)
2.) No (Quit)
"""
dside = input("Please enter a number to decide: ")
if dside == 2:
print "I knew you were a coward..."
raw_input('Press Enter to exit')
elif dside == 1:
print "Great! Let's get this adventure started"
raw_input('Press Enter to continue')
print """This is the tutorial level, here is where you will learn how to play.
To move the letter of a direction, n is north, e is east, s is south, w is west.
Press the '<' key to move up and the '>' key to move down.
Try it!
"""
move = raw_input('Where would you like to go?: ')
"n" = 1
"e" = 2
"s" = 3
"w" = 4
"<" = 5
">" = 6
if move == 1:
print "You move north."
if move == 2:
print "You move east."
if move == 3:
print "You move south."
if move == 4:
print "You move west."
print move
: 여기에 코드입니다.
오류는 ""literal "= value"이 수행되고 있음을 의미합니다. 이것은 허용되지 않으며'42 = 0'보다 더 이상 이해가되지 않습니다. 42는 42가 아니며 0이 아닙니다. 마찬가지로 "리터럴"은 "리터럴"이며 다른 값은 아닙니다. –