Comparing two arrays by index in python in a cleaner way
Don't use the loop-switch antipattern
If you have three different things that have to be done in order, just write them in that order. Don't put a loop around them with if-statements inside to check what has to be done that iteration; loops are for doing the same task over and over. What you are doing has a name: it is the loop-switch antipattern. Instead, just write:
#get data from dict and build first array
datadict={ 0:[], 1:[], 2:[], 3:[], 4:[], 5:[], 6:[], 7:[], }

#get data from dict and build second array
datadict={ 0:[], 1:[], 2:[], 3:[], 4:[], 5:[], 6:[], 7:[], }

#we now compare the arrays
...

I assume that's not the real code. If each of the three tasks is of course much longer than what you wrote, then it helps to put them in functions.
Split the problem up into smaller sections
It always helps to break up a problem into smaller sections, and for example you can then handle each sub-problem in a separate function. In this case, looping over the arrays can be split from deciding whether or not to keep a value. So:
keep_within_fifty_percent(a, b):
    fiftypercent = a // 2
    lower = a - fiftypercent
    upper = a + fiftypercent

    if b in range(lower, upper):
        return b;
    else:
        return 0

...

#we now compare the arrays
if len(array1) != len(array2):
    # handle error here
    ...

array3 = [keep_within_fifty_percent(a, b) for a, b in zip(array1, array2)]
print(&quot;final array: &quot;, array3)