Your first program in python 3

Posted by Bojidar Yankov on 25-01-2022

Your first program in python 3



Setup python

  1. Download and install python from here. If you are on mac or linux you probably already have it installed.
  2. Check if you have it installed by opening your terminal emulator (cmd for windows) and typing python3 --version:
python3 --version

Output

Python 3.8.10

Printing "Hello world!"

Create a file called hello.py and write the following:

# This is a comment, this line is not executed
# Using the "print" function to display the string of characters "Hello world!"
print("Hello world!")

Run the script using python3 hello.py:

python3 hello.py

Output

Hello world!