There is two parts to the Python software. 1: Python idle, 2: Python Shell. The Python idle is where you write your code and the Python shell is what opens when you run your code. Although you can write code in the Python shell my advise is don't.
SECTION 2 | YOUR FIRST CODE | HELLO WORLD
To get started and in this section we will simply print (output to the screen) the text 'hello world'. Just to check everything is working as expected. Follow the steps 3 below:
1: Open the Python Idle (not the Launcher) 2: You will need to create a new file so, go to FILE and click NEW FILE. (skip if you are using a different platform) 3: In the Python idle type the following 1 line of code: print ("Hello World") 4: To run your program press F5 on your keyboard (on a Mac hold 'fn' and press 'F5')
The program should open the Python shell and print the words : Hello world
The word print is a command word and might highlight in a different colour, it is used to print/output text and numbers to your screen. The ( ) are used to contain what you want to print. The speech marks " " tell Python that it is just simple text. Text is called a 'string' in programming terms.
ALTERNATIVE CODING PLATFORMS
SECTION 3 | VISUAL STUDIO CODE
For many of the tutorials on this website we use Microsoft Visual Studio Code, whilst this might take some getting used to, it is a very helpful platform that has loads of features that will help you as you start to progress in your coding journey. We recommend downloading Visual studio Code and persevering with the daunting task of getting stated with what at first can be a confusing platform. The link below takes you to the official Visual Studio Code site.
VSC Download Page
TO GET STARTED WITH VISUAL STUDIOC CODE
1: Downloading and Installing Visual Studio Code (VSCode)
Open your web browser and navigate to the official Visual Studio Code website: https://code.visualstudio.com/
Click on the "Download for [Your OS]" button. (The website will automatically detect your operating system, e.g., Windows, macOS, or Linux.)
Once the download is complete, locate the installer in your downloads folder and double-click on it to start the installation process.
Follow the on-screen instructions to complete the installation. The default settings are usually sufficient for most users.
2. Installing the Python Extension for Visual Studio Code
On the left sidebar, click on the Extensions icon (it looks like a square made of four smaller squares).
In the search bar at the top, type "Python".
Look for the Python extension by Microsoft (it should have the Microsoft logo and the name "IntelliSense" in the description).
Click on the Install button next to the Python extension.
3. Writing and Running Your First Python Code
First, ensure you have Python installed on your computer(Follow SECTION 1 on this page). If not, download and install it from the official website: https://www.python.org/downloads/
In VSCode, go to File > New File to create a new file.
Save the file with a .py extension, for example, hello_world.py.
In the new file, type the following code:
Save the file.
To run the file you can click the 'Play' button at the top right of the window (This will only appear after installing the Python extension 'Step 2'). Alternatively you can select 'Run without Debugging' from the drop down menu at the top of the window/screen.
You should see the output Hello, World! in the terminal at the bottom of the VSCode window.
WEB BROWSER IDE
Want a WEB BROWSER VERSION ? If you have a tablet or a chrome book you might want to use an online web browser platform for your python coding. Trinket is a great online version, it is easy to use and allows you to save and share your work. Trinket Online