This repository has been archived on 2022-06-22. You can view files and clone it, but cannot push or open issues or pull requests.
usaco-guide/additionalContent/Running_Python.mdx
2020-07-14 15:46:55 -07:00

26 lines
2 KiB
Text

## Running Python Locally
Download Python through [the official website](https://python.org). On Windows and Mac, you can download executable files directly; on Linux, you must either download the Python source code and compile from source, or obtain Python through your package manager.
Make sure that you are using the correct version of Python. Python 2 is quite different from Python 3 (but parts of the version number beyond 2. or 3. do not matter much). We generally recommend newcomers to use Python 3, but if you are used to programming in Python 2, that is OK too.
**The Python version can matter when using the command line to run Python;** sometimes, `python3` must be used instead of `python` in order to run Python 3. Try both commands, and pay attention to the version that Python prints, to determine if this is the case on your system. For example, running the following in Terminal on my computer produces:
```
python --version # prints Python 2.7.13
python3 --version # prints Python 3.8.1
```
Python comes with a program, known as IDLE (Integrated Development and Learning Environment), that allows one to write and run Python code. It supports many features, such as syntax highlighting and automatic indentation, that one would normally expect from an IDE/text editor. However, feel free to use another editor or IDE if you want to.
## Running Python Online
Both [CSAcademy](https://csacademy.com/workspace/) and [Ideone](http://ideone.com/) support running Python. See the "Running C++" page for more information about these two sites.
<warning-block>
If you use Ideone during an online contest (such as a Codeforces round), you **must** ensure that your code is set to be private. **You might be punished for cheating if another person finds and copies your code during the contest, even if you never intentionally provide the code to anyone.**
Even if you are not doing an online contest, you might want to set your code to be private for other reasons.
</warning-block>