Question

ZYBOOKS LAB: 10.23.1 Hello, I'm trying to solve this problem with creating a program code in...

ZYBOOKS LAB: 10.23.1

Hello, I'm trying to solve this problem with creating a program code in Python about People's Weights.

Here is the question: 10.23 LAB: Warm up: People's weights (Lists) (1) Prompt the user to enter four numbers, each corresponding to a person's weight in pounds. Store all weights in a list. Output the list. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 176.0 Enter weight 4: 166.3 Weights: [236.0, 89.5, 176.0, 166.3] (2) Output the average of the list's elements with two digits after the decimal point. Hint: Use a conversion specifier to output with a certain number of digits after the decimal point. (1 pt) (3) Output the max list element with two digits after the decimal point. (1 pt) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 176.0 Enter weight 4: 166.3 Weights: [236.0, 89.5, 176.0, 166.3] Average weight: 166.95 Max weight: 236.00 (4) Prompt the user for a number between 1 and 4. Output the weight at the user specified location and the corresponding value in kilograms. 1 kilogram is equal to 2.2 pounds. (3 pts) Ex: Enter a list location (1 - 4): 3 Weight in pounds: 176.00 Weight in kilograms: 80.00 (5) Sort the list's elements from least heavy to heaviest weight. (2 pts) Ex: Sorted list: [89.5, 166.3, 176.0, 236.0]

Here is my code in Python which is partially incorrect.

Code in Python:

weights=[] #declaring weights list

for i in range(0,4): #iterating loop to take 4 weights

print("Enter weight",str(i+1)+":")
  
temp=float(input("")) #taking input weigths from user

weights.append(temp) #appending it to list

print("Weights:" ,str(weights)) #printing all weights in a list

print("Average Weight:" ,format(round((sum(weights)/4),2),'.2f')) #average weight printing round off two decimal points

print("Maximum Weight:", format(round(max(weights),2),'.2f')) #printing maximum weight in a list round off to two decimals

input_number=int(input("Enter a List Location (1-4):\n" )) #asking user to enter the location

print("Weight in Pounds:" , format(weights[input_number-1],'.2f')) #printing value in that location since index starts with zero so taking i-1

print ("Weight in Kilo Grams:" ,format(((weights[input_number-1])/2.2),'.2f')) #printing weights value in kilograms by dividing with 2.2

weights.sort() #sorting the weights list

print("Sorted List:" ,weights) #printing final list

Can Anyone Help Please?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment...

Here I am attaching output, let me know any changes required..

Please follow the indentation properly. Then you will get correct output...

Add a comment
Know the answer?
Add Answer to:
ZYBOOKS LAB: 10.23.1 Hello, I'm trying to solve this problem with creating a program code in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello, can someone please help me correct this code? I greatly appreciate it. 7.16 Ch 7...

    Hello, can someone please help me correct this code? I greatly appreciate it. 7.16 Ch 7 Warm up: People's weights (Lists) (Python 3) (1) Prompt the user to enter four numbers, each corresponding to a person's weight in pounds. Store all weights in a list. Output the list. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 176.0 Enter weight 4: 166.3 Weights: [236.0, 89.5, 176.0, 166.3] (2) Output the average of the list's elements...

  • Hi, I need some help with the following question. I need the answer in Python please....

    Hi, I need some help with the following question. I need the answer in Python please. 10.23 LAB: Warm up: People's weights (Lists) (1) Prompt the user to enter four numbers, each corresponding to a person's weight in pounds. Store all weights in a list. Output the list. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 176.0 Enter weight 4: 166.3 Weights: [236.0, 89.5, 176.0, 166.3] (2) Output the average of the list's elements...

  • 5.23 LAB: Warm up: People's weights (1) Prompt the user to enter five numbers, being five...

    5.23 LAB: Warm up: People's weights (1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the array's numbers on one line, each number followed by one space. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 142.0 Enter weight 4: 166.3 Enter weight 5: 93.0 You entered: 236.0 89.5 142.0 166.3 93.0 (2) Also output the total weight, by summing the array's elements....

  • 14.5 Prog 5: People's weights (arrays) JAVA (1) Prompt the user to enter five numbers, being...

    14.5 Prog 5: People's weights (arrays) JAVA (1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the array's numbers on one line, each number followed by one space. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 142.0 Enter weight 4: 166.3 Enter weight 5: 93.0 You entered: 236.0 89.5 142.0 166.3 93.0 (2) Also output the total weight, by summing the array's...

  • 5.18 Ch 5 Warm up: People's weights (Vectors) (C++) (1) Prompt the user to enter five...

    5.18 Ch 5 Warm up: People's weights (Vectors) (C++) (1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in a vector of doubles. Output the vector's numbers on one line, each number followed by one space. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 142.0 Enter weight 4: 166.3 Enter weight 5: 93.0 You entered: 236 89.5 142 166.3 93 (2) Also output the total weight, by summing...

  • Need a basic program in C using the instructions above. Thanks. (1) Prompt the user to...

    Need a basic program in C using the instructions above. Thanks. (1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the array's numbers on one line, each number followed by one space. (2 pts) Ex: Enter weight 1: 236 Enter weight 2: 89.5 Enter weight 3: 142 Enter weight 4: 166.3 Enter weight 5: 93 You entered 236.000000 89.500000 142.000000 166.300000 93.000000 (2) Also output the total weight,...

  • Zybooks 11.12 LAB*: Program: Online shopping cart (continued) Python 3 is the code needed and this...

    Zybooks 11.12 LAB*: Program: Online shopping cart (continued) Python 3 is the code needed and this is in Zybooks Existing Code # Type code for classes here class ItemToPurchase: def __init__(self, item_name="none", item_price=0, item_quantity=0): self.item_name = item_name self.item_price = item_price self.item_quantity = item_quantity # def __mul__(self): # print_item_cost = (self.item_quantity * self.item_price) # return '{} {} @ ${} = ${}' .format(self_item_name, self.item_quantity, self.item_price, print_item_cost) def print_item_cost(self): self.print_cost = (self.item_quantity * self.item_price) print(('{} {} @ ${} = ${}') .format(self.item_name, self.item_quantity, self.item_price,...

  • For this portion of the lab, you will reuse the program you wrote before That means...

    For this portion of the lab, you will reuse the program you wrote before That means you will open the lab you wrote in the previous assignment and change it. You should NOT start from scratch. Also, all the requirements/prohibitions from the previous lab MUST also be included /omitted from this lab. Redesign the solution in the following manner: 1. All the functions used are value-returning functions. 2. Put the functions in an external module and let the main program...

  • Code in Coral please 2.17 LAB: Musical note frequencies On a piano, a key has a...

    Code in Coral please 2.17 LAB: Musical note frequencies On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 * rn, where n is the distance (number of keys) from that key, and r is 2(1/12). Given an initial key frequency, output that frequency and the next 4 higher key frequencies. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f}...

  • THE ATTACHMENTS:( needed to solve the problem above) (1) My Morse Code Program: #03/22/2018 #Creating a...

    THE ATTACHMENTS:( needed to solve the problem above) (1) My Morse Code Program: #03/22/2018 #Creating a program that translates sentences in to morse code def main():    morsecode_dict={}    line=""   f1 = open("MorseCode.txt",'r');    content = f1.readlines()    for x in content: #print x x=x.split() my_dict[x[0]]=x[1] print (morsecode_dict)    val=raw_input("Enter a String value: ") val.upper() output=""    for i in val: print (i.upper()) if(i!=' '): output = output + morsecode_dict[i.upper()]+' ' else: output = output+'\n' print ("-----Morse Code of The...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT