Hello World - Python

Python's populatiry grows more and more each day. With the Raspberry Pi foundation adopting it as an a language of choice in education settings, that popularity is only set to grow.

Hello World - Python

Although it shares some syntactic roots, Python is different to C because the language is interpreted. In the main, nothing is compiled before execution, and all statements are evaluated line-by-line as the application runs.

Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation via the off-side rule.

Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented and functional programming. It is often described as a "batteries included" language due to its comprehensive standard library.

Flavours of Python

In this example we're using the latest and greatest Python version - 3.11. In version 3, the syntax changed somewhat to make the syntax easier to understand.

How do we speak Python?

This one doesn't take much effort. Python is often described as 'batteries included' - the language and interpreter does a lot of the work for you to build the working environment needed to run.


print("Hello world")

It's really that simple! But what if we wanted to do something a bit more snazzy, add some colours perhaps? We'll get to see a few more features of the language that way:

import colorama
from colorama import Fore

print(Fore.RED + "Hello world!")
This one might not work in PowerShell or Windows CMD... Try linux :)

Here we start to see the powerful tools which come as part of Python, and from the vast community of developers who create modules for Python. Using the pip package we can pip install colorama, which will allow us to use the module in scripts going forward. The line above import colorama brings in the module to our script, and from colorama import Fore pulls the module's Fore class in a way that allows us to use Fore directly.