I am creating an array where most variables are held constant but a couple get looped thru with different values. If i wanted to easily select which two get looped, how would i do that?
Can you use variable names as variables? (Like in PHP) or is there a more pythonic way to write this.
import numpy as np
arrayValues=[]
apple=1
mango=2
banana=3
orange=5
kiwi=10
melon=9
pear=4
applerange=np.linspace(1,50,2)
bananarange=np.linspace(200,700,4)
for apple in applerange:
for banana in bananarange:
arrayValues.append([apple, mango, banana, (10-banana), orange, kiwi, melon, pear])
print('{} and {}'.format(round(apple,2),round(banana,2)))