0
Numpy.ndarray loop
I have numpyyy.ndarray a=([[1, 2, 3], [4, 5, 6],[7, 8, 9]]) and I want to print it like this 1 4. 7 2 5. 9 3 6 9 How can I do that in a loop? And how can I use the same approach to print an array but with a 1000 index's not only three?
7 odpowiedzi
+ 2
for t in zip (*a):
print (*t)
0
for c in range(len(a[0])):
for r in range(len(a)):
print(a[r][c],end=" ")
print()
0
Ollie Q what is the value of z?
0
Ollie Q can you share your answer in an example?
0
Here you go…
Sorry the other one was a bit hard to understand
https://code.sololearn.com/c1B4nVwussY9/?ref=app
- 1
X can start from zero but what about z?