Search
Introduction to Python

In this chapter we will provide a succinct introduction to Python for the uninitiated. We will not cover anything close to the entire capabilities of the programming language, but rather, just the parts that are relevant for use in solving problems within the context of scientific computing. There are many, many books that cover learning Python in depth as well as several online courses such as those offered by Codacademy or Datacamp. We will also assume familiarity with the venerable Jupyter notebook, i.e. the difference between Markdown and code cells, how to execute cells (Shift-CR), etc. If you are already proficient at Python, it's recommended that you skip this chapter.

Hello, World! program

The typical practice when learning a new programming language is to write what's called a "Hello, World!" program. This program is simply one that will print the phrase "Hello, World!" to the screen. In Python, this couldn't be easier. Simply type

print("Hello, World!")
Hello, World!

into a Python interactive console or Jupyter notebook cell and execute.