SHARE
TWEET

Xoay mảng 90 độ

haopoka Feb 14th, 2020 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Xoay mảng 3x3 90 độ
  2.  
  3. array3d = [[],[],[]]
  4. print("Hãy nhập mảng 3x3: ")
  5. for i in array3d:
  6.     for j in range(3):
  7.         x = int(input("Nhập x: "))
  8.         i.append(x)
  9. print("\nMang đã nhập: ")
  10. print(array3d)
  11. newarray = [[],[],[]]
  12. for i in range(3):
  13.     for j in array3d:
  14.         newarray[i].append(j[i])
  15.     newarray[i].reverse()
  16. print("mảng đã trộn:\n")
  17. print(newarray)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top