刚接触开发,有一个菜鸟问题。
我在这个 if 块的第二个语句中收到一个语法错误。 不知道为什么?请帮忙。
if engine_capacity <= 1600:
rate=.25
if engine_capacity >1600 and =<2000:
rate=.50
if engine_capacity > 2000:
rate=.75
答案 0 :(得分:0)
试试这个:
engine_capacity = 2000
if engine_capacity <= 1600:
rate = .25
if engine_capacity > 1600 and engine_capacity <= 2000: # <-- Should be <= not =<. You also need to type out the entire and statement, not just <= 2000
rate = .50
if engine_capacity > 2000:
rate = .75