2

It seems my if else statement throws a syntax error. I've read up on how if statements should be written (and the other if else statements in my script work with no issues) so I am not sure why there's an issue.

if small_wh <= 5.0:
    emColor = discord.Color.red
elif small_wh <= 15.0 and >= 5.1:
    emColor = discord.Color.orange

The >= (in the elif statement) is where it states the syntax error is.

John Kugelman
  • 349,597
  • 67
  • 533
  • 578

3 Answers3

1

The second comparison of you elif statement isn’t comparing anything to 5.1.

elif small_wh <= 15.0 and small_wh >= 5.1:
Jacob Lee
  • 4,405
  • 2
  • 16
  • 37
0

You should compare 5.1 with some value, not and word, i.e. do:

elif small_wh <= 15.0 and small_wh >= 5.1:

or using python capability to combine comparisons you can do::

elif 5.1 <= small_wh <= 15.0:
Daweo
  • 31,313
  • 3
  • 12
  • 25
0
if small_wh <= 5.0:
   emColor = discord.Color.red
elif small_wh <= 15.0 and small_wh >= 5.1:
   emColor = discord.Color.orange