Take 10 integer inputs from user and store them in a list and print them on
screen.
Answers
Answered by
5
Required Answer:-
Question:
- Write a Python script to taken 10 integer as inputs and store them in a list and print the list on screen.
Solution:
Here is the Python program.
l=[]
print("Enter 10 numbers...")
for i in range(0,10):
l.append(int(input("Enter: ")))
print("Here is the list...")
print(l)
Explanation:
- Ask the user to enter ten numbers. Append each elements in the list and display it.
- The append() function appends elements in the list.
Output is attached.
Attachments:
Answered by
2
Language used:
Python
Program:
Consider the attachment.
Explanation:
Line 1: Defines an empty list
Line 2: Runs the loop 10 times and the following line accepts the input.
Line 4: Attaches the value entered at the end of the list.
Line 6: Prints a line and the following lines print the elements of the list one per line.
Output:
Consider the attachment.
Attachments:
Similar questions
History,
1 month ago
Social Sciences,
1 month ago
English,
3 months ago
Biology,
9 months ago
Biology,
9 months ago