Question: this is for python. i want to be able to print just the first components of each numpy array within the list. like 0.5, 0.8,-4.1,10.7,-2.0

this is for python.
i want to be able to print just the first components of each numpy array within the list. like 0.5, 0.8,-4.1,10.7,-2.0
ive tried print(positions[0,0]) to see if that approach works and i got an error that says "list indices must be integers or slices,not tuple  this is for python. i want to be able to print
okay so i guess i need to use a for loop to do it, how would i go about this? just the first components of each numpy array within the list. like

au = 1.49be+11 # in meters masses = [1.0e24, 40.0e24, 50.0e24, 30.0e24, 2.0e24] # in kg positions = [np.array([ 0.5, 2.6, 0.05])*au, np.array([ 0.8, 9.1, 0.10])*au, np.array([-4.1, -2.4, 0.80]) *au, np.array([10.7, 3.7, 0.00]) *au, np.array([-2.0, -1.9, -0.40])*au] 4. In a new code cell, write code to print a nicely formatted table that includes each particle, its mass, and its x, y, z positions. Use a for loop to step through and positions lists to make this table. It should look something like the follow Note that you will need to extract the x and y values from your positions list of numpy arrays. You can either plot point-by-point using a for loop or you can extract the x and y values before plotting using a for loop or list comprehension

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!