MulaiMulai sekarang secara gratis

Flattening and reshaping

You've learned to change not only array shape but also the number of dimensions that an array has. To test these skills, you'll change sudoku_game from a 2D array to a 1D array and back again. Can we trust NumPy to keep the array elements in the same order after being flattened and reshaped? Time to find out.

numpy is imported as np, and sudoku_game is loaded for you.

Latihan ini adalah bagian dari kursus

Introduction to NumPy

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Flatten sudoku_game
flattened_game = ____

# Print the shape of flattened_game
print(____)
Edit dan Jalankan Kode