0

Python vector read

How can I read a vector without knowing any element before? I mean, if I want to read these numbers: 1 5 2 3 100 how can I read it? It’s a good option to read like this? : a, b, c, d, e = map(int, input().split()) from vector import* vector = (“i”, [a, b, c, d, e]) In C++ simply use while loop: i = 0; while(cin >> a) vector[i++] = a; But in python?

3rd Aug 2019, 2:24 PM
~ 꼰스탄틴 오니씸 ~
~ 꼰스탄틴 오니씸 ~ - avatar
1 ответ
0
#Something like this? def vector(*values): i=0 for each in values: flags=dict.fromkeys([chr(97+i)], values[i]) print(flags) i+=1 values=[1,5,3,2,100] vector(*values)
3rd Aug 2019, 11:21 PM
Steven M
Steven M - avatar