Presenting Python code using RISE | by Tanu N Prabhu | Towards Data Science

Your boss/professor tells you to find the largest number in a Python list and present the result in front of the whole employees/classmates. Now there are some rules that you need to follow to impress your boss/professor. They should be able to see both the documentation and code in this presentation. You should execute the code too. You may use any presentation tool of your choice. Now, how would you be able to present your code and ace it at the same time?
The above scenario can be easily tackled with the help of RISE — a Jupyter Notebook plugin, which can convert your .ipynb notebooks into a presentation (slideshow). The entire code of this article can be found on my GitHub Repository below:
github.com
Below are the six steps to present your python code using RISE
Write the python code/logic for the presentation.Install Python — later the better.Install Jupyter Notebook using the command prompt.Install RISE from the command prompt.After installing, open the Jupyter Notebook and check for the RISE button on the toggle bar.For creating a slide show, click on “View — Cell Toolbar — Slideshow”.
Write the python code/logic for the presentation.
Install Python — later the better.
Install Jupyter Notebook using the command prompt.
Install RISE from the command prompt.
After installing, open the Jupyter Notebook and check for the RISE button on the toggle bar.
For creating a slide show, click on “View — Cell Toolbar — Slideshow”.
Don’t worry, I won’t let you go or leave confused without explaining these steps in a detailed manner. Stay tuned!
Let’s write the logic of “find the largest number in a Python list”. The logic for this will be really minimalistic and easy to understand. Let’s use the below-given algorithm to write the logic:
Create a list of values.
Sort the list using sort().
Print the last element after it is being sorted.
# Create a list of valueslistValues = [-1, 10, -100, -50, 2]# Sorting the listlistValues.sort()# Printing the last elementprint("Largest element in the list is:", listValues[-1])
When you execute the above code you will be prompted by the largest number in the list
Largest element in the list is: 10
In this step, you need to download and install Python, but keep in mind the latest version is always the best version. It would be associated with all the additional features and plug-ins, let’s get not very specific here.
For Windows:
www.python.org
Video Installation
Remember: There might be a billion of ways to install all the below software, one might use docker, anaconda or, etc. But I wouldn’t be using any of those. Rather, I would follow the traditional methods which would be easy to understand and ace it. Also, in this tutorial, I would provide the installation commands for windows only, if you want to add any commands for other operating systems, comment section is all yours.
After downloading Python, navigate to the “Scripts” folder as shown below:
If you don’t know where to find “Scripts” use the below path, you will get it:
C:\Users\username\AppData\Local\Programs\Python\Python39\Scripts
There are two things that you need to take care of:
The username, in this case, differs. Please double-check this.Sometimes, you won’t be able to find AppData, so in this case go to the top and click on View, and check the box which says hidden items.
The username, in this case, differs. Please double-check this.
Sometimes, you won’t be able to find AppData, so in this case go to the top and click on View, and check the box which says hidden items.
After navigating to the Scripts folder. Open the path on your command prompt, or just press Ctrl+A and then type cmd and then press Enter, you will be directly navigated to the command prompt from the “Scripts” path. Use the following command to install Jupyter Notebook from your command prompt.
pip install jupyter notebook
Wait till it is successfully installed. By the way, the next time you want to open Jupyter Notebook, please type jupyter notebook to launch it. After opening the Jupyter Notebook to create a new Python notebook, on the right-hand top corner, click on the drop-down menu and then select Python 3 Notebook.
Video Example
After you have installed the Jupyter Notebook, the time has now come to install RISE. Just navigate to your command prompt and type in the below command to install it:
pip install RISE
If you need to read furthermore about RISE then there is no better place than the official docs given below:
rise.readthedocs.io
Installing RISE will automatically enable the option on the toggle bar as shown below, which clearly says “Enter/Exit RISE Slideshow”. This indicates that you have successfully installed RISE on your device.
Lastly, when your Python code and the documentation is ready, it’s time to present it. To present it click on the same RISE button it will automatically open your code in a presentation mode, meaning like a slide show as shown below:
Now if you need to edit your slides, or change their “Slide Type”, you need to navigate to “View — Cell Toolbar — Slideshow”. If you want to come out of this mode, select “None” from the same dropdown.
Currently, there are 5 different types of slides as shown below, you can choose from them, go ahead and try it out.
Note: You can independently choose a different slide type for every cell. Thanks to RISE.
Video Example
You have reached the end of this article “Presenting Python code using RISE”. I hope you guys have learned a thing or two from this tutorial. Suggestions are always welcomed here. If you have/facing any issues during installations, comment down below. I will respond ASAP. Until then, nail your Python code presentations, show them who is the boss in presentations. Stay tuned for more updates. Have a nice day!