+ 5

I do not know how to rotate the matrix. This is the only solution that I can come up with:(((

print("rotate matrix") lis=[(1,2,3), (4,5,6), (7,8,9)] print(lis[2][0],lis[1][0],lis[0][0]) print(lis[2][1],lis[1][1],lis[0][1]) print(lis[2][2],lis[1][2],lis[0][2])

21st Jan 2019, 1:55 AM
Khai123
Khai123 - avatar
6 odpowiedzi
+ 5
You essentially did the first step already. Now you should figure what the pattern is.
21st Jan 2019, 3:36 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
From:https://stackoverflow.com/questions/8421337/rotating-a-two-dimensional-array-in-JUMP_LINK__&&__python__&&__JUMP_LINK lis=[(1,2,3),(4,5,6),(7,8,9)] print(lis) rotated = list(zip(*lis[::-1])) print(rotated)
21st Jan 2019, 3:32 AM
Louis
Louis - avatar
21st Jan 2019, 7:56 AM
Dan Rhamba
Dan Rhamba - avatar
22nd Jan 2019, 8:34 AM
Ayush Sinha
Ayush Sinha - avatar
+ 1
thanks Bro
21st Jan 2019, 3:57 AM
Khai123
Khai123 - avatar
+ 1
I used to use zip but it did not work
21st Jan 2019, 3:57 AM
Khai123
Khai123 - avatar