Python-courses-python-exercises-python-sets-python-inheritance

Exercise 4

Write a program in Python that asks the user to enter 5 integers of their choice and display the list of numbers entered.

Solution

# initializing the list of numbers to enter
listNumbers = []
for i in range (0 , 5):
n = int (input ("Type the value of an integer:"))
# add the number n to the list
listNumbers.append (n)
# Display the list of entered numbers:
print ("Here is the list of entered numbers:", listNumbers)

Younes Derfoufi
my-courses.net

Leave a Reply