Exercise 4
Write a Python algorithm that asks the user to enter 5 integers of their choice and displays the list of numbers entered.
Solution
1 2 3 4 5 6 7 8 |
# initialize 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 numbers entered: ", listNumbers) |
Younes Derfoufi
CRMEF OUJDA
Acheter sur Très Facile !
1 thought on “Solution Exercise 4: python algorithm that displays the list of numbers entered by the user”