0

How can i read inputs from user in lists in python?

A similar eg is given below using java int A[] =new int[n] ;// n is no of elements for(int i=0;i<n;i++) { A[i] =in.nextInt(); } How can i perform a similar task in python

10th Jan 2018, 2:04 PM
Sachindra mishra
Sachindra mishra - avatar
2 odpowiedzi
0
To seperate each character into an element in a list, you can do this: x = list(input()) Or you could do the same thing as your example, except in Python: x = str(input()) y = [] a = 0 for z in x: y[a] = z a += 1
10th Jan 2018, 2:32 PM
Faisal
Faisal - avatar