Introduction

Python - A Quick Start for existing Programers

2 min read

Published Sep 16 2025, updated Sep 30 2025


21
0
0
0

Python

This is a quick start guide for people that have worked in other programming languages, so know basic programming knowledge, but have never used Python and just want to pick up the syntax quickly.




General characteristics

  • Interpreted language - Python is not compiled into machine code beforehand. Instead, the Python interpreter reads and executes code line by line.
  • High-level & readable - designed to be simple, human-readable, and expressive.
  • Cross-platform - runs on Windows, macOS, Linux, and more.



File & execution

  • Python files use the extension: .py
  • Code runs top to bottom, line by line.
  • Unlike languages such as Java or C, Python does not require a main() method—execution starts directly from the first line of code.

Run the .py file by calling from the command line (assuming Python 3 is installed):

python3 myfile.p

You can also run an interactive shell that will execute code as it is entered, rather than specifying a .py file. To enter the interactive shell mode:

python3



Variables

Dynamically typed - you don’t need to declare variable types. Python infers the type at runtime.

x = 5 # int
y = "Hello" # str
z = 3.14 # float

Variable types can change:

x = 5
x = "Now a string"



Code structure

  • Indentation-based - Python uses indentation (whitespace) instead of {} or keywords like begin/end to define code blocks.
  • Indents can be tabs or spaces, but not both in the same file.
  • Best practice: Use 4 spaces per indent.
  • A : symbol is usually used to denote when an indentation will start.

Example:

# Example if statement indentation
x = 10
if x > 5:
    print("x is greater than 5")
else:
    print("x is not greater than 5")

# Example for loop indentation
for i in range(5):
    print("Iteration", i)

# Example function definition indentation
def greet(name):
    print(f"Hello, {name}!")

greet("Alice")



Comments

Single line comments start with a # symbol:

# This is a comment
# This is also a comment
print("hello") # And this is a comment after the print statement

Multi line comments are between three matching ' or ":

"""
This is a multi line comment.
Everything between the 3 double quotes.
"""

'''
This is also a multi line comment.
Using single quotes.
'''

Products from our shop

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Mug

Docker Cheat Sheet Mug

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Mug

Vim Cheat Sheet Mug

SimpleSteps.guide branded Travel Mug

SimpleSteps.guide branded Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - Black

Developer Excuse Javascript Mug - Black

SimpleSteps.guide branded stainless steel water bottle

SimpleSteps.guide branded stainless steel water bottle

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Dark

Developer Excuse Javascript Hoodie - Dark

© 2025 SimpleSteps.guide
AboutFAQPoliciesContact