Learn how to create magic cubes using Python dictionaries and adjacency matrices in this video tutorial by Charles Kelly. These are explained in the context of computer science and data science to technologists and students in preparation for machine lear
- [Teacher] In this video, I'll illustrate…how we can construct our MagicCube class.…First, notice that the MagicCube…is dependent upon MagicCharacteristics.…MagicCharacteristics, in turn,…are dependent upon AdjacencyMatrix.…If you're following along with the video,…the first thing that you should do is scroll down…to this cell with the definition for AdjacencyMatrix…and execute that cell, that is, press Shift+Enter.…Now do the same thing for the MagicCharacteristics class.…
By doing this, we made the definitions…of MagicCharacteristics and AdjacencyMatrix…accessible to our MagicCube class.…And I mentioned in passing, if we were developing this…in an integrated development environment,…we wouldn't need to go through this.…We keep each of these classes in separate files,…and the import statements would be handled correctly.…Our MagicCube class is relatively simple.…
The reason is we used object-oriented design to encompass…or encapsulate most of the complexity within other classes,…and in this case, the classes were the AdjacencyMatrix…
- Using Jupyter Notebook
- Creating NumPy arrays from Python structures
- Slicing arrays
- Using Boolean masking and broadcasting techniques
- Plotting in Jupyter notebooks
- Joining and splitting arrays
- Rearranging array elements
- Creating universal functions
- Finding patterns
- Building magic squares and magic cubes with NumPy and Python
Skill Level Intermediate
2. Create NumPy Arrays
3. Index, Slice, and Iterate
4. Plots: Matplotlib and Pyplot
5. Manipulate Arrays
6. Short Examples
7. Extended Examples
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.