Introduction
Python - A Quick Start for existing Programers
2 min read
This section is 2 min read, full guide is 44 min read
Published Sep 16 2025, updated Sep 30 2025
21
Show sections list
0
Log in to enable the "Like" button
0
Guide comments
0
Log in to enable the "Save" button
Respond to this guide
Guide Sections
Guide Comments
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
Copy to Clipboard
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
Copy to Clipboard
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 likebegin/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")
Copy to Clipboard
Toggle show comments
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.
'''