Python


Python is a general purpose programming language used for several courses at the university. We will be using the latest version of Python 3. Python is available in EHS 117 and EHS 119, along with a full-featured integrated development environment.

Depending on your operating system, you may already have Python 3 installed. From a shell ("Terminal" on OS X or "Command Prompt" on Windows), type python3 at the prompt and press enter. If you receive a "command not found" or similar error, you'll need to install Python.


Installing

You may also download and install Python on your personal machine (available for Windows, Linux, and OS X). Take care to download the correct version number (e.g., Python 3.x, see above) for your operating system. Note that a slightly newer version is typically ok; check with your instructor to confirm.


Getting Started

After confirming you can run python3 on your computer, proceed to the next step.


Environment

Run a shell. At the shell prompt, type python3 and press enter. Verify that the correct Python version is reported.

For example, on Ubuntu linux:

$ python3
Python 3.8.2 (default, Apr 27 2020, 15:53:34) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

If any errors occur, verify that python3 is on your path. See Python Setup and Usage documentation for additional instructions. There are helpful tips for each operating system:


First Steps

Type the following at the >>> prompt, pressing enter after each line:

name = 'world'
print('Hello, ' + name + '!')

Verify that your program runs without errors and displays the expected output.

For example:

Hello, world!

This page was last modified on 2022-09-01 at 11:15:02.

Copyright © 2018–2024 George Fox University. All rights reserved.