+ 2

why do i get a generator object?

i expected a matrix https://code.sololearn.com/c64OkY2J9I2e/?ref=app

3rd Jan 2023, 9:06 AM
Oma Falk
Oma Falk - avatar
4 RĂ©ponses
+ 2
Hi, Oma Falk ! # Because you created a generator expression inside the print function, like this: print(i for i in range(3)) # in the same way like this: s = sum(i for i in range(11)) print(s) # You can try this: print(G := (i for i in range(5))) for k in G: print(k)
3rd Jan 2023, 10:13 AM
Per Bratthammar
Per Bratthammar - avatar
3rd Jan 2023, 10:16 AM
Oma Falk
Oma Falk - avatar
+ 1
Try this easy code: n = int(input()) print(hex(n)[2:]) Happy codding
3rd Jan 2023, 9:14 AM
FꫀâČ…áƒ«á„†ÍŸá„™á„‰áŻœ
FꫀâČ…áƒ«á„†ÍŸá„™á„‰áŻœ - avatar
+ 1
yeah easy but i want this way....short oneliner
3rd Jan 2023, 9:21 AM
Oma Falk
Oma Falk - avatar