Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write this in PYHTON! and as simple as possible People's Weights Overview In this program, you will use incremental development to manipulate a list.
Please write this in PYHTON! and as simple as possible
People's Weights
Overview
In this program, you will use incremental development to manipulate a list.
Objectives
Be able to:
Get a list of numbers
Display the individual numbers of a list
Find the average and maximum of the numbers in a list
Perform calculations on a number in a list
Sort a list
Description
In this problem, you will first need to prompt for how many weights should be added to a list. You will gather the weights in pounds from input one at a time adding them to a list. There will be the same number of weights to get from input as the first inputted number. From here, display the list to the user along with the average and maximum weights. Next, ask the user for a location in the list and convert that weight to kilograms and display the converted weight. Following this, sort and display the list again. Finally, display the list of weights again, along with what the weights would be on Mars.
Note: Use the built in Python function round to round the weights to decimal point after any calculation has been performed on them. The way the Python round function works is that it takes the item to be rounded as the first argument, and the number of decimal places as the second argument. So if you have a variable x that contains the value roundx would return a value of
One run of the full program is as follows:
Enter the number of weights:
Enter a weight:
Enter a weight:
Enter a weight:
Enter a weight:
Weights:
Average weight:
Max weight:
Enter a list location:
Weight in pounds:
Weight in kilograms:
Sorted list:
Weight on Earth:
Weight on Mars:
Think about how you would do this before you continue reading. Come up with pseudocode for how you would solve this problem. Then see if it follows the same logic presented here. If you do not know where to start, read the first step below and then try to construct the rest of the program on your own. Commonly, the hardest part of writing a program is knowing where to start. Try to begin without using the guide below. If you need more information on how to convert pounds to kilograms or how to convert the weight on earth to the weight on Mars, look at steps and below.
Prompt the user for the number of weights and then prompt the user to enter the weights, each corresponding to a persons weight in pounds. Store all the weights in a list. Output the list.
Ex:
Enter the number of weights:
Enter a weight:
Enter a weight:
Enter a weight:
Enter a weight:
Weights:
Output the average of the lists elements with one digit after the decimal point.
Ex using inputs above:
Average weight:
Output the max list element with one digit after the decimal point.
Ex using inputs above:
Max weight:
Prompt the user for a number between and the number of weights in the list. Output the weight at the user specified location and the corresponding value in kilograms. kilogram is equal to pounds.
NOTE List indexing starts at This number starts at You will need to make the number match the correct list location.
Ex using inputs above:
Enter a list location:
Weight in pounds:
Weight in kilograms:
Sort the lists elements from least heavy to heaviest weight.
Ex:
Sorted list:
Create another list for the weights on Mars. To compute weight on Mars, take the weight on Earth and divide by Earths gravitational force, which is Then multiply by the Mars gravitational force, which is
Print out each set of weights as follows:
Ex: If the sorted list of weights is
Weight on Earth:
Weight on Mars:
Congratulate yourself on a job well done!
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