{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "Presenting Python code using RISE.ipynb", "provenance": [], "collapsed_sections": [], "authorship_tag": "ABX9TyPoW7ZxXRRtBk7u1jwnRQcA", "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "metadata": { "id": "O80IfnBGxIQ-" }, "source": [ "# **Presenting Python code using RISE**\r\n", "\r\n", "## **In this article, you will use RISE as a Python jupyter notebook extension for turning it into a live presentation**\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n" ] }, { "cell_type": "markdown", "metadata": { "id": "uXExmJqDy2-M" }, "source": [ "# **Scenario**\r\n", "\r\n", "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?\r\n", "\r\n", "---\r\n", "\r\n", "\r\n", "# **Solution**\r\n", "\r\n", "\r\n", "The above scenario can be easily tackled with the help of [RISE](https://rise.readthedocs.io/en/stable/index.html) — a Jupyter Notebook plugin, which can convert your `.ipynb` notebooks into a presentation (slideshow).\r\n", "\r\n", "\r\n", "---" ] }, { "cell_type": "markdown", "metadata": { "id": "EvM7k7E_zV_k" }, "source": [ "# **Steps**\r\n", "\r\n", "\r\n", "## **Below are the six steps to present your python code using RISE**\r\n", "\r\n", "\r\n", "1. Write the python ***code/logic*** for the presentation.\r\n", "2. Install Python — later the better.\r\n", "3. Install Jupyter Notebook using the command prompt.\r\n", "4. Install RISE from the command prompt.\r\n", "5. After installing, open the Jupyter Notebook and check for the RISE button on the toggle bar.\r\n", "6. For creating a slide show, click on “***View — Cell Toolbar — Slideshow***”.\r\n", "\r\n", "\r\n", "> Don’t worry, I won’t let you go or leave confused without explaining these steps in a detailed manner. Stay tuned!\r\n", "\r\n", "---" ] }, { "cell_type": "markdown", "metadata": { "id": "mZ5CIu-8zt_r" }, "source": [ "# **An explanation for the above steps**\r\n", "\r\n", "\r\n", "## **1. Write the python code/logic for the presentation**\r\n", "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:\r\n", "\r\n", "* Create a list of values.\r\n", "* Sort the list using `sort()`.\r\n", "* Print the last element after it is being sorted." ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ZqseQY_lz8zj", "outputId": "49efa8ec-eec7-4697-e6ad-c05057982d15" }, "source": [ "# Create a list of values\r\n", "listValues = [-1, 10, -100, -50, 2]\r\n", "# Sorting the list\r\n", "listValues.sort()\r\n", "# Printing the last element\r\n", "print(\"Largest element in the list is:\", listValues[-1])" ], "execution_count": 1, "outputs": [ { "output_type": "stream", "text": [ "Largest element in the list is: 10\n" ], "name": "stdout" } ] }, { "cell_type": "markdown", "metadata": { "id": "6-fA6jqE0BCd" }, "source": [ "When you execute the above code you will be prompted by the largest number in the list.\r\n", "\r\n", "---\r\n" ] }, { "cell_type": "markdown", "metadata": { "id": "e2WVLwsW0D6n" }, "source": [ "## **2. Install Python — the later the better**\r\n", "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.\r\n", "\r\n", "For windows - Download [here](https://www.python.org/downloads/windows/)\r\n", "\r\n", "\r\n", "### **Video Installation**\r\n", "\r\n", "Click here for the [video](https://www.youtube.com/embed/UvcQlPZ8ecA)" ] }, { "cell_type": "markdown", "metadata": { "id": "IO5uNh5J0_8w" }, "source": [ "> ***Remember***: There might be a billion of ways to install all the below software, one might use [docker](https://www.docker.com/), [anaconda](https://www.anaconda.com/) 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.\r\n", "\r\n", "---\r\n", "\r\n" ] }, { "cell_type": "markdown", "metadata": { "id": "J1osHxJk1L3B" }, "source": [ "## **3. Install Jupyter Notebook using the command prompt**\r\n", "\r\n", "After downloading Python, navigate to the “***Scripts***” folder as shown below:\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "If you don’t know where to find “Scripts” use the below path, you will get it:\r\n", "\r\n", "\r\n", "```\r\n", "C:\\Users\\*username*\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\r\n", "```\r\n", "\r\n", "\r\n", "**There are two things that you need to take care of:**\r\n", "\r\n", "1. The `username`, in this case, differs. Please double-check this.\r\n", "2. 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`.\r\n", "\r\n", "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.\r\n", "\r\n", "```\r\n", "pip install jupyter notebook\r\n", "```\r\n", "\r\n", "\r\n", "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.\r\n", "\r\n", "### **Video Example**\r\n", "\r\n", "Click here for the [video](https://www.youtube.com/embed/otmWEEFysms)" ] }, { "cell_type": "markdown", "metadata": { "id": "dozeObJs2vbY" }, "source": [ "\r\n", "\r\n", "---\r\n", "\r\n" ] }, { "cell_type": "markdown", "metadata": { "id": "CPy4c_FX2wA3" }, "source": [ "## **4. Install RISE from the command prompt**\r\n", "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:\r\n", "\r\n", "```\r\n", "pip install RISE\r\n", "```\r\n", "\r\n", "If you need to read furthermore about RISE then there is no better place than the official docs given below:\r\n", "\r\n", "[RISE 5.7.1](https://rise.readthedocs.io/en/stable/installation.html)\r\n", "\r\n", "---" ] }, { "cell_type": "markdown", "metadata": { "id": "3MCyom3a296R" }, "source": [ "## **5. After installing, open the Jupyter Notebook and check for the RISE button on the toggle bar**\r\n", "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.\r\n", "\r\n", "\r\n", "\r\n", "---" ] }, { "cell_type": "markdown", "metadata": { "id": "Mlxj-IJm3GqK" }, "source": [ "## **6. For creating a slide show, click on “View — Cell Toolbar — Slideshow”**\r\n", "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:\r\n", "\r\n", "[Slide Show](https://miro.medium.com/max/1050/1*tTseBgtxHLuJSvx6g_cCXw.gif)\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "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.\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "Currently, there are 5 different types of slides as shown below, you can choose from them, go ahead and try it out.\r\n", "\r\n", "> ***Note***: You can independently choose a different slide type for every cell. Thanks to RISE.\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "\r\n", "### **Video Example**\r\n", "\r\n", "Click here for the [video](https://www.youtube.com/embed/utNl9f3gqYQ)\r\n", "\r\n" ] }, { "cell_type": "markdown", "metadata": { "id": "Alzqvxbr3_sX" }, "source": [ "# **Conclusion**\r\n", "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!\r\n", "\r\n", "---" ] } ] }