Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,18 @@
*.pyd
*.bin
*.pkl
*.venv
*.idea
__pycache__
.pytest_cache
.ruff_cache

# config & context
.vscode
.claude
**/.vscode/
**/.claude/
**/.idea/
**/.venv/
**/build/
**/__pycache__/
**/.pytest_cache/
**/.ruff_cache/
**/.logs/
**/.tmp/

# clang
/clang_2026/guides

# builds
build

# ai-notes & logs
gemini
CLAUDE.md

# other dirs and files
*linux_commands
0x_c_extension
books
cloud
0x_problems
template-rules.md
ml-types.md
# fastapi/x-project/data
fastapi-projects/**/data/*.csv
fastapi-projects/**/data/*.json
19 changes: 17 additions & 2 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Ruff configuration file
target-version = "py314"
extend-include = ["*.ipynb"]

# Set line length limit to 120 (more modern & forgiving than 88)
line-length = 120

# Exclude virtual environments and cache directories
exclude = [
".venv",
"venv",
"__pycache__",
".pytest_cache",
".ruff_cache",
".logs",
]

[lint]
select = ["E", "F", "I"]
select = ["E", "F", "I"] # E: errors, F: pyflakes, I: isort(import sorting)
# Ignore line-too-long (E501) and module-import-not-at-top (E402 for notebooks)
ignore = ["E501", "E402"]
8 changes: 4 additions & 4 deletions 00_basics/00_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
print("Hello, world")

# variables
name = "Saqib, Bedar" # type string
age = 22 # integer
height = 5.4 # float
is_student = True # bool
name = "Saqib, Bedar" # type string
age = 22 # integer
height = 5.4 # float
is_student = True # bool
4 changes: 2 additions & 2 deletions 00_basics/01_types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "Alice"
age = 25

print(type(name)) # <class 'str'>
print(type(age)) # <class 'int'>
print(type(name)) # <class 'str'>
print(type(age)) # <class 'int'>
2 changes: 1 addition & 1 deletion 00_basics/02_input.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name = input("What's your name?")

print(f"Hello, {name}!")
print(f"Hello, {name}!")
4 changes: 2 additions & 2 deletions 00_basics/03_typecasting.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# age = input("What's your age?")
# print(age+1) # Error: can't add string and number

# input() function always return string so we need to
# input() function always return string so we need to

age = int(input("What's your age?"))

print(f"You will be {age+1} next year!")
print(f"You will be {age + 1} next year!")
44 changes: 22 additions & 22 deletions 00_basics/04_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@
a = 10
b = 3

print(a + b) # 13 β†’ Addition
print(a - b) # 7 β†’ Subtraction
print(a * b) # 30 β†’ Multiplication
print(a / b) # 3.3333 β†’ Division (always returns float)
print(a + b) # 13 β†’ Addition
print(a - b) # 7 β†’ Subtraction
print(a * b) # 30 β†’ Multiplication
print(a / b) # 3.3333 β†’ Division (always returns float)
print(a // b) # 3 β†’ Floor division (removes decimal)
print(a % b) # 1 β†’ Modulus (remainder)
print(a ** b) # 1000 β†’ Exponent (10 to the power of 3)
print(a % b) # 1 β†’ Modulus (remainder)
print(a**b) # 1000 β†’ Exponent (10 to the power of 3)


# Comparison Operators
x = 10
y = 20

print(x == y) # False β†’ Equal to
print(x != y) # True β†’ Not equal to
print(x > y) # False β†’ Greater than
print(x < y) # True β†’ Less than
print(x == y) # False β†’ Equal to
print(x != y) # True β†’ Not equal to
print(x > y) # False β†’ Greater than
print(x < y) # True β†’ Less than
print(x >= 10) # True β†’ Greater than or equal
print(x <= 9) # False β†’ Less than or equal
print(x <= 9) # False β†’ Less than or equal

# Assignment Operators
score = 100

score += 10 # same as score = score + 10 β†’ 110
score -= 5 # same as score = score - 5 β†’ 105
score *= 2 # same as score = score * 2 β†’ 210
score //= 3 # same as score = score // 3 β†’ 70
score += 10 # same as score = score + 10 β†’ 110
score -= 5 # same as score = score - 5 β†’ 105
score *= 2 # same as score = score * 2 β†’ 210
score //= 3 # same as score = score // 3 β†’ 70


# Example usage
Expand All @@ -48,22 +48,22 @@
age = 20
has_id = True

print(age >= 18 and has_id) # True β†’ both are true
print(age < 18 or has_id) # True β†’ one is true
print(not has_id) # False β†’ flips True to False
print(age >= 18 and has_id) # True β†’ both are true
print(age < 18 or has_id) # True β†’ one is true
print(not has_id) # False β†’ flips True to False


# Identity Operators
x = None

print(x is None) # True
print(x is None) # True
print(x is not None) # False


# Membership Operators
name = "Alice"
fruits = ["apple", "banana", "mango"]

print("A" in name) # True
print("mango" in fruits) # True
print("grape" not in fruits) # True
print("A" in name) # True
print("mango" in fruits) # True
print("grape" not in fruits) # True
2 changes: 1 addition & 1 deletion 00_basics/05_conditionals.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
print("Withdraw balance is too small")
else:
balance -= withdraw
print(f"Withdrawn! Remaining balance: {balance}")
print(f"Withdrawn! Remaining balance: {balance}")
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
num_list: int = [1, 2, 3, 4, 5]
num_list: list[int] = [1, 2, 3, 4, 5]

# print full list
print(num_list) # Output: [1, 2, 3, 4, 5]
print(num_list) # Output: [1, 2, 3, 4, 5]

# loop over list
for num in num_list:
Expand All @@ -12,4 +12,4 @@
# 2
# 3
# 4
# 5
# 5
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
numList = [10, 20, 30]

print(f"{" Tuples ".center(36, "=")}")
print(f"{' Tuples '.center(36, '=')}")
for num in enumerate(numList):
print(num)

Expand All @@ -13,7 +13,7 @@
"""

# accessing values separate, index, and actual entry at index
print(f" Debug ".center(36, "="))
print(" Debug ".center(36, "="))
for i, num in enumerate(numList):
print(f"{i=}, {num=}")

Expand All @@ -22,4 +22,4 @@
i=0, num=10
i=1, num=20
i=2, num=30
"""
"""
Loading
Loading