+ 1

list comprehension of multiple inputs

lt=[int(x) for x in input("ENTER : ").split()] Can anyone explain the above code, please?. Means how it works.

18th Sep 2019, 5:10 PM
Dileep Patcha
Dileep Patcha - avatar
2 Respostas
+ 3
Input() returns a string "string".split returns a list of characters int() then converts all those characters into integers and stores them in the list (comprehension)
18th Sep 2019, 6:15 PM
Trigger
Trigger - avatar
0
Thankyou sir for clarifying
18th Sep 2019, 6:22 PM
Dileep Patcha
Dileep Patcha - avatar