(Jan-10-2019, 05:57 AM)scidam Wrote: No loops needed. Numpy can do all the work by itself:This works neatly but I'm sorry I should have mentioned that I'm asked to do this using indexing and looping.three = three * np.arange(three.shape[0])[:, np.newaxis] # 0-based numbering # or three = three * np.arange(1, three.shape[0] + 1)[:, np.newaxis] # 1-based numbering
I was able to find a way and wanted to post back. Here's what worked
Thanks for the help
for i in range (0,5): three[i]=three[i]*(i+1)