I'm trying to use a list comprehension for two not nested for loops. This is my solution without list comprehension:
import numpy as np
n_steps = 20
x_steps = [int(i) for i in np.linspace(10, 60, n_steps)]
y_steps = [int(i) for i in np.linspace(25, 150, n_steps)]
steps = [(x_steps[i], y_steps[i]) for i in range(len(x_steps))]
As you can see I want steps = [(10, 25), (13, 31), ...]
Is there an elegant and pythonic way to do it in one line with list comprehension or similar? In my mind I have something like this:
steps = [(int(x), int(j)) for x in np.linspace(10, 60, n_steps) and j in np.linspace(25, 150, n_steps)]