Starting with Python

getting started with this data-oriented programming language
2025-11-03 12:04
// updated 2025-11-10 08:44

In this article, we will look at:

  • how to practice Python
  • look at some basic code samples

How to practice

At least 3 popular ways for us to get started with Python:

  • Using the W3Schools' sandbox
  • Using the Google Colab notebooks
  • Installing Python on our local machines

🚌 Using the W3Schools sandbox

  • Go straight to the W3Schools sandbox
    • Great for playing around with Python code right away
    • No account required but no saving work either!

📝 Using the Google Colab notebooks

  • Go straight to the Google Colab website
    • Great for learning Python and taking rich-text notes on the side
    • Requires a Google Drive account but lets us save our work in separate files to keep things organized!

ðŸ’ŧ Installing Python on the local machine

This Codecademy article should explain in great detail how to install Python for Windows and Macs; installing on the local machine:

  • might take some time and mouse clicks to set up
  • might prove beneficial in the long-run as it prepares the computer for actual development of Python applications

Installation for Macs (used by this article's author)

  • Download Python from https://www.python.org/downloads/macos/
  • Run the installer like any desktop app, following the instructions
  • After installation, open the Terminal app and run the python3 --version command; the version number should output to the Terminal

(Optional step to alias the "python3" command to "python")

Since Mac comes with Python version 2, the python command by default refers to python2, but we can make Python version 3 the default by having the python alias refer to python3 by editing a file called .bash_profile:

  • run this command in Terminal:
open ~/.bash_profile 
  • add the following to the file:
alias python="python3"
alias pip="pip3"
  • save the file and now run the python --version command
    • we have done this step correctly if it outputs the version number
    • we can then use python instead of python3 in our Terminal commands!

"Hello, world"

The most basic way to start Python is to print something using the print() method:

# helloworld.py - this is a comment!

print("Hello world!")

If saving this file on the local machine, we can call it helloworld.py and then run the following command on the same working folder:

$ python helloworld.py

The output of "Hello world!" should then print after the Terminal command!

There, we have written our first Python program 😆

Another example

Now with something a bit more interesting:

# helloworld2.py - this is a comment

def main():
  print('hello world - this prints the stuff in the main function')
  secondary_function()

def secondary_function():
  print('prints when calling this function from main')
  tertiary_function()

def tertiary_function():
  print('prints when calling this function from secondary_function')

main()
  • commenting
    • most with programming experience (and without Python experience) might gather that the first line represents a comment (starting with # to denote its role as a comment)
  • indentation consistency
    • in Python, we must indent consistently to help both the computer and the human parse (or read) the code
  • def keyword
    • used to define a function
  • main function
    • when the program runs, it will call this function (unless otherwise specified)
  • print function
    • when the program runs, it will output the contents inside the brackets
newer (in textbook-python) ➡ïļ
Python input and output 🐍
⮅ïļ older (in code)
ðŸĪ” Opening a link to a new window?
newer (in code) ➡ïļ
Python input and output 🐍
⮅ïļ older (posts)
ðŸŠķ 2025-10
newer (posts) ➡ïļ
Python input and output 🐍