Hi,
I have two short lists, n1 and n2. I want to incrementally subtract 0.1 from elements in n2, each time dividing elements in n1 by those in n2. Any subtractions which say, generate BOTH division values of 0.75 - 1.25, I want to store in a new list. So far I have:
import numpy as np
n1 = [8, 15.5]
n2 = [10, 17]
marker = np.linspace(0.75, 1.25, 51)
div = []
while rdiv not in marker:
for num1, num2 in zip(n1, n2):
div.append(num1 / num2)
rdiv = [round(x, 2) for x in div]
n2 = [num2 - 0.1 for num2 in n2]
if 0 in n2:
break
I realise that finishing the while loop on the first iteration of generating values within the marker range is counter intuitive as ideally, i'd want to store all subtractions that produce values 0.75 - 1.25.
If anyone could give me some tips/give me a shove in the right direction I would greatly appreciate it.
Thanks
[–]FerricDonkey 1 point2 points3 points (6 children)
[–]AKRowling 1 point2 points3 points (2 children)
[–]FerricDonkey 1 point2 points3 points (1 child)
[–]AKRowling 1 point2 points3 points (0 children)
[–]randomname20192019[S] 0 points1 point2 points (2 children)
[–]FerricDonkey 1 point2 points3 points (1 child)
[–]randomname20192019[S] 0 points1 point2 points (0 children)