Skip to main content

Writing Python Code

First, let's take a look at how to run Python code on your computer.

note

We will be writing code in Jupyter Notebook. This is a simple way to write code that you can run in the browser.

Installation

info

We will be using Anaconda to launch Jupyter Notebook.

Steps

  1. Download Anaconda for your operating system from Anaconda's Website
  2. Run the downloaded installer
  3. Once installed, search for Anaconda Navigator and click on it
  4. Launch Jupyter Notebook
  5. Once Jupyter Notebook opens in your browser, click on New in the top-right corner of the screen and select Python 3

Once complete, you should see this

Jupyter Notebook New Blank Notebook

Writing Code

You are now ready to start writing code!

tip

Have alot of code? Try writing in a new code block by pressing Shift + Enter.

tip

You can execute your code by pressing Shift + Enter inside of the code block.

Now, take some time to write some code!

Example

Example code showing how to assign x a value of 1, and proceed to display the value of x