For loop Issue - Python

Can any help me explain what is wrong in the script I have an error, unable to get output


This is the error i get


is it because i need to define float ?

Nope. That’s because the operator is not correct.
Use and instead of &

@AmolShah The operator is sorted out, I think the input is just a single value and not a list, so should we have to use if condition here ?

If it is always going to be a single value then no need to put in the for loop.
But if it can either be a single value or a list of values, then we would like to put in a for loop.
But a for loop cannot iterate over a something that is not a list (i.e a single element). So we convert that single element to list and leave the rest to the loop

So I might do something like this

Check your input!
It should be: RainIntensity = IN[0]

1 Like

My mistake good sport :), thanks for solving the issue @AmolShah

1 Like

Hello you can write
elif 1.25 < i <= 1.3:
instead of
elif i > 1.25 and i <= 1.3: