0

How we can print 2D array without brackets & commas and what is the way to format them.

For example: We have an array like: [[ 1, 2, 3] [4, 5, 6] [7, 8, 9]] Want to be printed like this: 1 2 3 4 5 6 7 8 9

28th Dec 2021, 8:52 AM
Rupali
Rupali - avatar
7 ответов
+ 2
I think these codes can help you: for r in range(len(d)): # rows for c in range(len(d[r])): # columns print (d[r][c], " ", sep="", end="") print() https://code.sololearn.com/clDbt6xx58vB
28th Dec 2021, 5:23 PM
SoloProg
SoloProg - avatar
+ 4
Rupali attempt.......???
28th Dec 2021, 8:53 AM
Slick
Slick - avatar
+ 4
Since you don't wanna try, I'll say that '*' can be used for more than multiplication.
28th Dec 2021, 9:04 AM
Slick
Slick - avatar
+ 2
# try this d = [[ 1, 2, 3], [4, 5, 6], [7, 8, 9]] for a in d: print (*a) https://code.sololearn.com/clDbt6xx58vB
28th Dec 2021, 9:40 AM
SoloProg
SoloProg - avatar
+ 1
28th Dec 2021, 8:54 AM
Rupali
Rupali - avatar
+ 1
Thank you 👍it helped me alot
28th Dec 2021, 5:35 PM
Rupali
Rupali - avatar
0
How we can use formatting to do the same..because for that also we need to access each element in the array
28th Dec 2021, 1:36 PM
Rupali
Rupali - avatar