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
  • 330,190
  • 66
  • 504
  • 555

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
  • 3,649
  • 2
  • 12
  • 30
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
  • 21,690
  • 3
  • 9
  • 19
0
if small_wh <= 5.0:
   emColor = discord.Color.red
elif small_wh <= 15.0 and small_wh >= 5.1:
   emColor = discord.Color.orange