Question
Python Programming Question:Data collections Projectiles. Write a program that has the user enter information on some projectiles: the name, mass mm in kg, and velocity
Python Programming Question:Data collections
Projectiles. Write a program that has the user enter information on some projectiles: the name, mass mm in kg, and velocity vv in m/s of each. This should be done using a loop-and-a-half construct; the projectiles should be saved in a list (each projectile itself being a list of the name, mass, and velocity). For example, the list might be [ ["A", 15, 23], ["B", 20, 0], ["C", 18, 15] ] (three particles called A, B, and C; A's mass and velocity are 15 kg and 23 m/s, and so on) this is similar to how the movie collection lecture example stores movies. Once all the points are entered, you should display:
all the particles, sorted by mass (most massive particles first);
all the particles, sorted by velocity (fastest particles first);
all the particles, sorted by kinetic energy (calculated as Ek=12mv2Ek=12mv2 the units are Joules (J)). (For this you'll make a function that takes a projectile as parameter a list of name, mass, and velocity and returns the kinetic energy, then use that as the key in a sort().)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started