# Could someone check if this is correct, please?

Discussion created by Alesinar on Jul 31, 2014
Latest reply on Aug 4, 2014 by Alesinar

I have two lists:

```A=[0, 45, 90, 135, 180, 225, 270, 315, 360]
k8=[4.729216146562631, 4.979995034716688, 5.83433020080749, 5.834682335428627, 5.555339121638964, 4.292788277464533, 5.875322012861815, 5.214309700178062]
```

As I started using python recently I developed one very inelegant code (below). The aim is to do calculation with every element of k8 if the element of A falls within certain angle defined by az. So if g is between az-45 and az+45 it will be multiplied by 1 and so on. The results of the multiplication are then appended to empty list k9. At the end the code should check at which place in list (k9) is the highest element and exstract value at the same place from another list (k1).

The code runs without errors, however I'm not certain if it produces correct results and if it will do so with any az. Could please some one with experience check if the code is correct. Also if someone knows a better solution for the problem, go ahead.

```    for g in A:
for h in k8:
bz1=az-45
if bz1<0:
bz1=bz1+360

bz2=az+45
if bz2>360:
bz2=bz2-360

if g>bz1 and g<bz2:
k=h*1.0
k9.append(k)

bz3=az-90
if bz3<0:
bz3=bz3+360

bz4=az+90
if bz4>360:
bz4=bz4-360

if g>bz3 and g<bz4:
k=h*0.75
k9.append(k)

bz5=az-135
if bz5<0:
bz5=bz5+360

bz6=az+135
if bz6>360:
bz6=bz6-360

if g>bz5 and g<bz6:
k=h*0.5
k9.append(k)

bz7=az-135
if bz7<0:
bz7=bz7+360

bz8=az+135
if bz8>360:
bz8=bz8-360

if g<bz7 and g>bz8:
k=h*0.25

k9.append(k)
break
ll=len(k9)
print ll

print k9

def highestNumber(k9):
myMax = k9
for num in k9:
if myMax < num:
myMax = num
return myMax
print highestNumber (k9)

smer=k9.index(highestNumber (k9))
print smer
czk=k1[smer]
```