- 1

Alternate code to give same output as my following code .

list_1=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] x,y=map(int,input().split()) list_2=list_1[x:y] for i in list_2: print(i)

8th Oct 2020, 5:57 PM
partha
partha - avatar
4 Réponses
+ 2
x,y=(int(i) for i in input().split())
8th Oct 2020, 6:13 PM
Abhay
Abhay - avatar
+ 1
Rough one-liner print("\n".join((lambda inp: [str(i) for i in range(1,11)[int(inp[0]): int(inp[1])]])(input().split())))
8th Oct 2020, 10:21 PM
Zerokles
Zerokles - avatar
+ 1
print(list_1[slice(*map(int, input().split()))]) https://code.sololearn.com/cKPnyIph8qwI/?ref=app
9th Oct 2020, 1:14 AM
Bilbo Baggins
Bilbo Baggins - avatar
+ 1
thanks everyone for helping me better my understanding
9th Oct 2020, 12:14 PM
partha
partha - avatar