Generator object | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Generator object

Why does this code return a generator object print(int (x) for x in input().split())

17th Aug 2022, 12:08 PM
Haxsys
Haxsys - avatar
1 Resposta
+ 3
Because that is what the code does... If you wanted a list for example, you could make it a list comprehension: print([int (x) for x in input().split()])
17th Aug 2022, 12:10 PM
Lisa
Lisa - avatar