0
How to make list from input user,example.If i input 3,output is [1,2,3] and when u input 2 after 3,result is [2,4,6].Like that
list in python
2 Respostas
+ 1
There is more than one way to get that output given that input;
this code does it:
x = int(input("?"));
res = [i for i in range(1,x+1)];
print(res);
y =int(input("?"));
res2 = [y*i for i in res];
print(res2);
0
The complete question like this :
Make script infinite loop whom accept iteration number from input user and make output array list with structure like this :
$ python script.py
input: 3
[1, 2, 3]
input: 2
[2, 4, 3]
input: 6
[3, 6, 6, 4, 5, 6]
input: 1
[4, 6, 6, 4, 5, 6]
input: 1
[5, 6, 6, 4, 5, 6]