如果关于冒号的语句错误是"无效的语法。"

时间:2018-04-08 15:15:13

标签: python python-2.7

第11行中的if语句继续读取有关冒号是"无效语法的错误。"

import time
import random
H1 = int(raw_input("Input Health 1"))
H2 = int(raw_input("Input Health 2"))
H3 = int(raw_input("Input Health 3"))
H4 = int(raw_input("Input Health 4"))
print ("A meme approaches. Do you approach?")
print ("Yes | No | Let the dice roll decide")
print (" 1  | 0  |        1/20             ")
RespToMeme = int(raw_input("Respond to the meme, boi.")
if RespToMeme == 1:
    print("It is an angery meme. Y'all dead son.")
elif RespToMeme == 0:
    print("You live on.")
elif RespToMeme == 1/20:
    MemeRespRoll = random.randint(1, 20)
    print ("you rolled", MemeRespRoll)
    if MemeRespRoll => 11:
    MemeApproach = true
    elif MemeRespRoll =< 10:
    MemeApproach = false

我一直收到有关该行的错误。

1 个答案:

答案 0 :(得分:0)

import time
import random
H1 = int(raw_input("Input Health 1"))
H2 = int(raw_input("Input Health 2"))
H3 = int(raw_input("Input Health 3"))
H4 = int(raw_input("Input Health 4"))
print ("A meme approaches. Do you approach?")
print ("Yes | No | Let the dice roll decide")
print (" 1  | 0  |        1/20             ")
RespToMeme = int(raw_input("Respond to the meme, boi."))
if RespToMeme == 1:
    print("It is an angery meme. Y'all dead son.")
elif RespToMeme == 0:
    print("You live on.")
elif RespToMeme == 1/20:
    MemeRespRoll = random.randint(1, 20)
    print ("you rolled", MemeRespRoll)
    if MemeRespRoll >= 11:
         MemeApproach = 'true'
    elif  MemeRespRoll <= 10:
        MemeApproach = 'false'

现在它适合你