name = raw_input('What is your name?\n')
hi = raw_input('Are you having a good day, %s. \n' % name
if hi == "yes"
i == raw_input("great. \n")
if i = "thanks":
q = raw_input("you're welcome \n")
if q == "bye":
print("=)")
else:
print("Have a great day, Good Bye \n")
elif hi == "no":
n = raw_input("that is sad. hope your day gets better, %s \n" % name)
if n == "bye":
print("Good Bye, %s \n" % name)
else:
print("Hope your day gets better, Good Bye.")
else:
print(" ")
print(" ")
print(" Please enter yes or no.")
print(" *You need to restart the program")
这是说(i == raw_input(“ great。\ n”))的语法无效
答案 0 :(得分:1)
在python中,当您看到invalid syntax for "whatever"
时,请检查“任何内容”上方的行
因此您的问题是在第一个if语句中缺少:
if hi == "yes"
应该是
if hi == "yes":
答案 1 :(得分:1)
如评论中所述,您只是在:
之后缺少if hi == "yes"
。
这是一个常见错误,消息会提示您实际问题后的一行。