creating user inputs as a list

 '''creating user inputs as a list'''

new_list=[]
n=int(input("enter the size of the list" ))
print("enter the elements one by one")
for a in range(0,n):
z=int(input())
new_list.append(z)
print(new_list

"C:\Users\darul Haram\PycharmProjects\pythonProject2\venv\Scripts\python.exe" "C:/Users/darul Haram/PycharmProjects/pythonProject2/venv/Lib/user input as a list.py"
enter the size of the list4
enter the elements one by one
2
4
6
8
[2, 4, 6, 8]

Process finished with exit code 0

Comments

Popular posts from this blog

XAMPP, SQL BASIC COMMANDS

The Minion Game Hackerrank Solution

Arrays - DS | HackerRank Solutions