Adventures in Python: A Closer Look at IDE and Notebooks

Roch Derilo
Analytics Vidhya
Published in
5 min readOct 1, 2020

Starting out this series to document my adventures in learning the language.

Python, being an elegant language, is fantastic in itself. It’s an interpreted language that is widely used in different fields. Its syntax is high-level enough so we can focus more on solving problems rather than getting engulfed by so many rules.

As part of my adventures in exploring Python as a data science tool, it’s a great exercise to create simple projects where some concepts are directly applied. What could be more fun than creating games!

I was first exposed to Python a little over a year ago when I created a short visual novel game using a Python-based game engine. It was quite different from what I’m doing now as first, it was still using Python 2; and second, the game engine has an impressive library of functions and other objects which made coding it a lot easier. I got hooked on the storyline and game logic. And that’s the beauty of Python. It allows you to focus on what you really wanted to do.

As with other data science tools, I needed to learn Python 3 as it’s going to be like my Swiss Army knife in the jungle of analytics. My first task was to create a quiz that will show the player’s name and score.

I’m currently using a Linux Mint desktop while learning a whole bunch of great data science tools. The screenshots, navigation, and other contexts may differ from those who are using other operating systems.

IDE at a Glance

For someone who has done programming, IDE (also known as Integrated Development Environment) is a familiar tool. There are proprietary and there are open-source IDE options for almost every language possible. Examples of IDE are Code, Eclipse, NetBeans. Python actually has its own IDE which is called IDLE.

An IDE is much more than just a text editor (Notepad++ is not an IDE, unfortunately). A text editor is just for writing or editing lines of code, but an IDE allows you to compile, interpret, run, debug, and a whole lot more than just being a plain text editor.

Spyder IDE

Spyder is a widely used IDE for scientific programming dedicated to Python. It easily integrates the more scientific Python libraries such as pandas, Matplotlib, NumPy, and SciPy. After all, Spyder is an acronym for The Scientific Python Development Environment.

I’m currently using Spyder 3, installed via apt. Anaconda Navigator, however, has the more updated Spyder 4. I opened my quiz.py file as I explored its features.

Using it feels like using any other IDE. I think it’s quite convenient to use even for a beginner. It doesn’t seem intimidating to use and you can just focus on what needs to be done.

The Spyder interface is simple and easy to navigate. The console at the lower right section runs the code showing at the left panel.

What are Notebooks, Really?

It was only recently that I got introduced to the concept of notebooks. Jupyter has always been talked about; Google initiated the development of Colaboratory (or Colab); even Spyder has a plugin called Spyder Notebook.

Demystifying notebooks for someone uninitiated like me is a bit of a challenge. However, the explorer in me did not give up. I used notebooks as I see them used by my mentors and other people sharing their codes online.

In a notebook, you can freely use a mix of codes, text, plots, and other visuals, and each of them can be placed in a cell. Notebooks are actually a collection of cells. Each cell can be run by using Shift+Enter or by tapping the play button for each cell.

Notebooks are more than just a place to write and run codes. The experience is quite different from using an IDE. I see people that even use notebooks to teach and to tell stories.

Jupyter Notebook

Unlike Spyder that can be opened direct from my home menu, Jupyter needs a few more steps to initiate.

Screenshot of my home directory, showing how to navigate to Jupyter Notebooks folder.
From my home directory, I needed to navigate to the Jupyter Notebooks folder.

From my home directory, I needed to navigate to the Jupyter Notebooks folder. I then opened my terminal from there and used the command jupyter notebook to open the tool.

Screenshot of the terminal showing the command to open Jupyter Notebooks.
This is how Jupyter Notebook initiates. It then opens on a browser.

I opened the same quiz.py file I opened with Spyder earlier. This is how the code displays inside Jupyter. When I hovered above the Language menu, it displayed a list of other languages Jupyter can support. It just shows how useful and powerful Jupyter is!

Screenshot of my quiz code when it opens on Jupyter Notebook.
A notebook such as Jupyter can read literate languages, which promote readability and comprehension between machine and human languages.

Another thing that Jupyter can do is to convert a *.py (Python) file into a *.ipynb (IPython notebook) file. Spyder couldn’t read a notebook file unless the notebook plugin is used. I opened my new quiz.ipynb file on Colab as the image below shows.

Colaboratory — A Cloud-Based Notebook

Since Jupyter is an open-source project, other developers can create their own notebooks from it. And that’s what Google did with Colab. Other than that, they hosted it on Google servers so anyone can access it right away, without the need to install or set up anything. As a bonus, files can be uploaded to Google Drive or GitHub.

A screenshot of my quiz game as it shows in Colab.
See the RAM and Disk meter at the upper right corner? That’s how much resources my quiz notebook was consuming at that moment.

Just like in Jupyter, Colab uses cells and they can be either in text or code form. My code can be run by clicking the play button or pressing Shift-Enter while the cell is selected.

Beneath the code is where the program actually runs. The input function asks for, well, input from the user.
I got a perfect score from taking my own quiz! Yeah, I’m that good.

It was fun exploring Spyder, Jupyter, and Colab. Each has its own merit and I can see myself using any of them, depending on my needs. Data science can be a demanding field and being adept at these tools will definitely work for anyone who wants to enter the industry.

Check out my quiz files. Tune in for my next adventures in Python!

(This is the first article in my series. Here’s the second.)

--

--

Roch Derilo
Analytics Vidhya

A lover of data, tech, and hot choco. Supports anything open source and its power in the data value chain.