subject

This is a warm-up prompt lab, was shown code by the teacher, I plug it in and the output is correct but the computer system won't grade it because it's getting an "EOF when reading a line" error code, any suggestions? (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 index location (0 - 3):
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:

peopleWeights = []
num_weights = 4

for i in range(num_weights):
singleWeight = float(input('Enter weight %d:\n' % (i+1)))
peopleWeights. append(singleWeight)

print('Weights:', peopleWeights)

avgWeight = sum(peopleWeights)/len(peopleWeight s)
print('\nAverage weight: %.2f' % avgWeight)

print('Max weight: %.2f'% max(peopleWeights))

index = int(input('\nEnter a list index (1 - 4):\n'))
chosenWeight = peopleWeights[index-1]
print('Weight in pounds: %.2f' % chosenWeight)
print('Weight in kilograms: %.2f' % (chosenWeight/2.2))

peopleWeights. sort()
print('\nSorted list:', peopleWeights)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 13:00
Which one of the following voltages should never be measured directly with a vom? a. 1200 v b. 500 v c. 800 v d. 100v
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
1. which of the following is not an example of an objective question? a. multiple choice. b. essay. c. true/false. d. matching 2. why is it important to recognize the key word in the essay question? a. it will provide the answer to the essay. b. it will show you a friend's answer. c. it will provide you time to look for the answer. d. it will guide you on which kind of answer is required.
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
question
Computers and Technology, 23.06.2019 20:00
Me ajude por favor , coloquei uma senha e não consigo tira-la no chorme
Answers: 2
You know the right answer?
This is a warm-up prompt lab, was shown code by the teacher, I plug it in and the output is correct...
Questions
question
Arts, 09.03.2021 17:10
question
Mathematics, 09.03.2021 17:10
question
Social Studies, 09.03.2021 17:10
question
Chemistry, 09.03.2021 17:10
question
Mathematics, 09.03.2021 17:10
question
Biology, 09.03.2021 17:10
question
Mathematics, 09.03.2021 17:10
question
Mathematics, 09.03.2021 17:10
question
Mathematics, 09.03.2021 17:10
question
Mathematics, 09.03.2021 17:10
Questions on the website: 13722363