write a python program to remove all numbers in a list
Answers
Answered by
1
Answer:
The given program is written in Python.
n=int(input("How many elements? "))
a=[]
print("Enter them...")
for i in range(n):
a.append(int(input(">> ")))
print("Given list:",a)
a.clear()
print("Modified list:",a)
Explanation:
- To remove all the items in a list, the clear() method is used.
- Using this function, the problem is solved.
Variable Description:
Refer to the attachment.
•••♪
Attachments:
Similar questions