+ 2
why do i get a generator object?
i expected a matrix https://code.sololearn.com/c64OkY2J9I2e/?ref=app
4 Answers
+ 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)
+ 1
Try this easy code:
n = int(input())
print(hex(n)[2:])
Happy codding
+ 1
yeah easy but i want this way....short oneliner