Hi everyone. First post here because I'm completely stuck on my homework assignment. I don't have a strong coding background so any help is greatly appreciated.
I have a set of 25 randomly generated numbers. The array is shaped 5 x 5.
I need to be able to multiply the numbers in each row with it's row numbers.
All numbers in row 1 x 1, all numbers in row 2 x 2 etc.
Here is what I have and I'm not sure how to get the address (row number) for every item in the array:
I have a set of 25 randomly generated numbers. The array is shaped 5 x 5.
I need to be able to multiply the numbers in each row with it's row numbers.
All numbers in row 1 x 1, all numbers in row 2 x 2 etc.
Here is what I have and I'm not sure how to get the address (row number) for every item in the array:
import random mu, stdev = 5, 5 random.seed(1) three = np.random.normal(mu, stdev, 25).reshape(5,5) for x in three: y = x * x.shape[0] print (x.shape[0])