解析时意外的EOF?
问题描述:
import random
import time
print ('WELCOME TO MYSTREY MADNESS warning this is my first game their will be bugs')
time.sleep (2)
print ('you will be asked to pick a route and the game will pick a random outcome')
time.sleep (2)
print ('pick one of the two options that will appear in a moment type 1 or 2 next to the one that you wnat to pick')
time.sleep (2)
guess_1 = int(input('you are at the beach you are bored type 1 to go to the rock pools type 2 to go to the cave')
if guess_1 == 1
("you went to the rock pools what do you do now?")
else guess_1 == 2,
print('you go to the cave and look into the darkness what do you do now?'),
我对我唯一的输入尝试了原始输入,但它仍然给我一个错误消息。解析时意外的EOF?
答
正如Morgan所说,你的代码有一些语法错误。您应该关闭一些括号并在一些行的末尾删除昏迷。 此代码应该很好:
import random
import time
print ('WELCOME TO MYSTREY MADNESS warning this is my first game their will be bugs')
time.sleep (2)
print ('you will be asked to pick a route and the game will pick a random outcome')
time.sleep (2)
print ('pick one of the two options that will appear in a moment type 1 or 2 next to the one that you wnat to pick')
time.sleep (2)
guess_1 = int(input('you are at the beach you are bored type 1 to go to the rock pools type 2 to go to the cave'))
if (guess_1 == 1):
print("you went to the rock pools what do you do now?")
elif (guess_1 == 2):
print('you go to the cave and look into the darkness what do you do now?')
+1
请删除'if(guess_1 == 1):'中的圆括号。他们是多余的。 '如果guess_1 == 1:'就够了。 – Matthias
您的语法有很多基本错误。你可能想重新阅读你正在经历的教程。 –