Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Python program that will do the following: 1) Ask the user for how many

ID: 3724095 • Letter: W

Question

Write a Python program that will do the following:

1) Ask the user for how many values they would like to enter. This value must be between 1 and 15, inclusive (enforce the range.) Hereafter this quantity will be known as “numValues”.

2) Create a list of numValues values(floats) by calling a function named input_nums(). That function, which is called just once, will handle the input of the numValues values and storing them into a list that it returns.

*All numbers need to be printed to (only) one decimal place.*

Explanation / Answer

def input_nums(n):
lst = []
for i in range(n):
value = float(input("Enter the number: "))
lst.append(value)
return lst
  
numValues = int(input("Enter the number of values: "))
lst = input_nums(numValues)
for i in range(len(lst)):
print(round(lst[i],1))

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote