get list input from user in python
a = list(map(int,input("nEnter the numbers : ").strip().split()))
get list input from user in python
a = list(map(int,input("nEnter the numbers : ").strip().split()))
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)
pythin taking input for array
x = list(map(int, input("Enter the values with spaces between them: ").split()))
# you can put the data type that you want in the "int" place
taking array input in python
x=[int(input()) for i in range(int(input("How many elements are in list : ")))] print(x)
taking array input in python
x=[] for i in range(int(input("How many elements are in list : "))): x.append(int(input())) print(x)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us