In each iteration of the loop, use the input() function to take input from a user
Convert user input to float number using the float() constructor
Add float number to the numbers list using the append() function
Solution:
numbers = []
# 5 is the list size
# run loop 5 times
for i in range(0, 5):
print("Enter number at location", i, ":")
# accept float number from user
item = float(input())
# add it to the list
numbers.append(item)
print("User List:", numbers)
Hint:
numbers
input()
function to take input from a userfloat()
constructornumbers
list using theappend()
functionSolution:
need an explanation for this answer? contact us directly to get an explanation for this answer