无效语法错误 python 2.7

invalid syntax error python 2.7

我的代码中有这个 If 语句:

        if h >= 65 and h < 75
            lcd.set_cursor(0,1)
            lcd.message("Medium")

我收到这个错误:

if h >= 65 and h < 75
                    ^
SyntaxError: invalid syntax

你能帮帮我吗,我不知道为什么会这样。

您没有在 if 语句的末尾放置 :。

if h >= 65 and h < 75:
   lcd.set_cursor(0,1)
   lcd.message("Medium")

尝试在第一行加一个冒号,即:

if h >= 65 and h < 75: