Answers for "python how to create new array from input"

0

array as an input in python

list1 = list() #empty list

num = input("How many elements do you want") #user tells the range(optional)

#iterating till user's range is reached
for i in range(int(num)): 
    n = input("Enter a value ")#asking for input of 1 value 
    list1.append(int(n))#adding that value to the list

print(list1)
Posted by: Guest on October-18-2021

Code answers related to "python how to create new array from input"

Python Answers by Framework

Browse Popular Code Answers by Language