santiagoesc Posted March 16, 2021 Share Posted March 16, 2021 Im trying to put a stored value inside the range of a "for" loop, and I don't know if that's permitted, an example would be: M = np.array([[8,8,8,8], [8,8,8,8], [8,8,8,8], [8,8,8,8]]) for j in range (4): for i in range(4): for k in range(2,M[i,j]): if M[i,j] % k == 0: print("yes") else print("no") Link to comment Share on other sites More sharing options...
Ingolme Posted March 17, 2021 Share Posted March 17, 2021 I don't use Python much, but it looks like it should work just fine. The variable M is available and can be passed into the range() function, so there should be no problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now