Python Programming Basics
Quick Core Language Syntax and Structure Reference Guide
1. Variables and Core Data Types
Python dynamically handles data types. You don't need to explicitly declare types when binding
values to variables.
# String, Integer, Float, and Boolean declarations
username = "Elliot"
login_attempts = 3
pi_value = 3.1415
is_admin = True
2. Lists and Dictionaries
Lists represent ordered sequences, while dictionaries map structured key-value pairs.
# Lists (Ordered, mutable sequences)
tools = ["nmap", "wireshark", "metasploit"]
[Link]("hydra")
# Dictionaries (Key-Value structural maps)
target_host = {
"ip": "[Link]",
"status": "active",
"open_ports": [22, 80, 443]
}
3. Conditional Logic and Loops
Indentation defines block structures strictly in Python syntax.
# Conditional Branching
if target_host["status"] == "active":
print(f"Scanning target: {target_host['ip']}")
else:
print("Target system is offline.")
Page 1
# Iterating via For Loops
for tool in tools:
print(f"Initializing {tool} framework...")
Page 2