Question: # Step 1 : Input 4 weights and store them in a list weights = [ ] for i in range ( 4 ) :

# Step 1: Input 4 weights and store them in a list weights =[] for i in range(4): weight = float(input(f"Enter weight {i +1}: ")) weights.append(weight) # Output the list of weights print(f"Weights: {weights}") # Step 2: Calculate and output the average weight with two decimal places average_weight = sum(weights)/ len(weights) print(f"Average weight: {average_weight:.2f}") # Step 3: Output the maximum weight with two decimal places max_weight = max(weights) print(f"Max weight: {max_weight:.2f}") # Step 4: Prompt user for a list location (1-4) and output the weight in pounds and kilograms location = int(input("Enter a list location (1-4): ")) pounds = weights[location -1] # Convert user input to zero-based index kilograms = pounds /2.2 print(f"Weight in pounds: {pounds:.2f}") print(f"Weight in kilograms: {kilograms:.2f}") # Step 5: Sort the list and output it weights.sort() print(f"Sorted list: {weights}")

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 Programming Questions!