How to fill list from input user?Like this.If i input 3 the result is [1,2,3] and when i input 2 for 2nd result is [2,4,3] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to fill list from input user?Like this.If i input 3 the result is [1,2,3] and when i input 2 for 2nd result is [2,4,3]

python bab tuple and list

11th Nov 2016, 1:57 AM
omi
2 Answers
+ 1
it's just one list.My expectation is when the input fill with 3,if the second input are 5.Output is input 1 + 2 and if len(5)-len(3) are 2.The result will be this 2,4,6,4,5.I want to ask how to make the next input can recognized for variabel change second input and operation will be continue
12th Nov 2016, 2:25 PM
omi
0
I can't find a logic for the 2nd input. The first one is easy: input_num = int(input("Number: ")) print(list(range(1, input_num+1)))
11th Nov 2016, 1:26 PM
Gleb Golov
Gleb Golov - avatar