Exercise 4

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

Solution

# initialization of 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