Python Starting

From Computer Science
Revision as of 17:00, 20 August 2022 by Jkinne (talk | contribs) (Connect to the CS Server)
Jump to: navigation, search

To get started with Python programming, you need to be able to run the program. Here are some ways to get started...

Install Python

You can install python on your personal computer. You download from python.org/downloads, and it normally auto-detects your OS. Click the download button, install it, and open it open after it's installed.

Python Online

There are various websites that provide an online Python environment that you can use in your web browser. Most of these are fine to use to get started. One that we are familiar with that you could try is repl.it.

Connect to the CS Server

The CS server has python installed. If you have an account for the CS systems (see CS Accounts and CS Lab Computers) then you can use this account to login to the CS server and run Python in the terminal. See CS Server - Terminal for how to connect to the CS server. Once you are logged into the server, you can run python in interactive mode by simply running: python3

To run a python program that is in your account on the server, you would run: python3 filename.py where filename.py is the name of the file you want to run.

Note that the python might be running an older version of python (python2). You can tell by running this command: python --version

If this prints a version that is 2.something, you should use the command python3 to make sure you are using the current version of python (as above).