python语法错误比较运算符

时间:2018-06-01 17:04:35

标签: python

我正在运行一个elif循环,但无论何时我运行这行代码,它都会给我错误消息,我在这里找不到语法错误

elif (rand_num-10)<=guess_num<=rand_num or rand_num<=guess_num<=(rand_num+10)

错误消息是

  

elif(rand_num-10)&lt; = guess_num&lt; = rand_num或rand_num&lt; = guess_num&lt; =(rand_num + 10)                                                                                   SyntaxError:语法无效

2 个答案:

答案 0 :(得分:2)

你错过了elif和条件后的boolean exists = tempNameMapList.stream().anyMatch(map -> map.containsValue("tim"));

:

答案 1 :(得分:-1)

你的问题在于最后的冒号