Apply multi-condition of python script on each index of an input list

Hi,
i want the script to scan an input list of numbers (angles) than give an orientation basing on item value and specific ranges where it fits for example: if the value of item index 0 is >=0 && a<=22.5 : then print(‘North’)

i have two problem in this script that i couldn’t solve!

  1. this actual script group the same output together instead of maintaining the output with the relevant input index .
  2. also the last script has a problem and it made the node yellow when i wrote it;
    for i in xrange(0,len(alist)):

    if alist[i] >=0 && a<=22.5 :
    OUT.Add(‘North’)

&& is DS syntax and not python. In python simply use ‘and’.

This should probably simplify your code a little:

for item in alist:
    if item == 0: OUT.append("North")
    elif item == 360: OUT.append("North")
    # and so on
    elif item >= 0 and a <= 22.5: OUT.append("North")