EME 210
Data Analytics for Energy Systems

Understanding Python

PrintPrint

Understanding Python

When we say, “Python is a coding language”, we're referring to the particular combination and order of characters (or “syntax”) that you'll be writing on the screen. Much like English is a language that can be communicated in different forms (written or spoken), Python is a language that can be communicated to the computer in different ways. In this course, instead of writing files containing Python commands (“scripts”), you'll primarily be using Jupyter Notebooks to write and run your Python code. In particular, we will use Google Colaboratory (or “Colab”) notebooks, which have the added advantages of being accessible through any web browser and running the code not on your own computer, but rather Google's servers (a “cloud” environment). Not only will these Colab notebooks contain all your Python code and provide you with an environment in which to run the code, but you can also augment your code with blocks of text. These blocks of text give you space to provide the reader with an explanation of what your code does and an interpretation of the results. 

Jupyter/Python at on arrow pointing to the words Google Colaboratory and one arrow pointing to the the words IDE (Integrated Development Environment).
A conceptual diagram of comparative ways in which Python code can be written and run.
Credit: Eugene Morgan © Penn State is licensed under CC BY-NC-SA 4.0  

An alternative environment to Google's Colaboratory service for writing Jupyter Notebooks containing Python code is an Integrated Development Environment (IDE). An IDE is installed on one's own, local computer and run there, using that computer's resources. It provides a nice, user-friendly interface for developing code. For example, one popular IDE is Anaconda, which is also installed in computer labs on Penn State's campuses. Prior to installing an IDE, such as Anaconda, you must first install Python. Again, Python is the language and an IDE just provides a method of writing in that language. Installing Python gives your computer the instructions for “speaking” that language, while installing the IDE gives you a convenient method for “talking” to your computer in that language.

For the assignments in this course, it doesn't matter how you develop your code, whether in Colab or an IDE. However, you must submit all assignments, including the code, in the Colab format (so you can copy and paste from the IDE to the Colab notebook, if you'd like, as long as you can successfully run the code in Colab). The reason for this restriction is that Canvas, which contains your assignments and grades, will be linked to Colab via a service called “Google Assignments”. This allows the instructors to view your work, even before you submit it (for example, if you need help), and also effectively grade your code directly in Colab.

The next section will introduce you to Google Colab and how to access it from a Canvas assignment.


frequently asked questions FAQ