•5 min read

The Python Fundamentals You Actually Need to Start

The Python Fundamentals You Actually Need to Start
Python Basics

Python Variable

Click to reveal
Python Basics
A named reference to a value. Python doesn't declare types — the type lives on the value, not the variable name.

Python Variable

Python Basics

Indentation

Click to reveal
Python Basics
Python uses whitespace (spaces/tabs) to define code blocks instead of {}. Incorrect indentation = SyntaxError or wrong logic.

Indentation

Python Basics

f-string

Click to reveal
Python Basics
Formatted string literal: f"Value is {value}". Fast, readable, and the preferred way to embed expressions in strings since Python 3.6.

f-string

Python Fundamentals: No Bullshit Guide

Everything you build in Python is just a combination of describing data (variables) and controlling what happens next (loops & conditions). Here are the foundational blocks.

Audio Briefing
0:00 / 0:00
The Golden Rule of Python

Indentation is law. Python uses whitespace (spaces/tabs) to define code blocks instead of {}. Get your indentation right, or nothing works.


The Core Building Blocks

ConceptSyntaxExampleCommon Mistake
Variables
name = value
age = 25
name = "5" + 5 (TypeError)
Type Conversion
int(), float(), str()
int(input())
forgetting to convert input()
Comparison
==, !=, <, >
if score == 90:
if score = 90: (assignment!)

1. Variables & Types

You don't declare types, but you must respect them. Mixing types blindly (like "5" + 5) is the #1 beginner mistake.

  • int (whole numbers), float (decimals)
  • str (text strings), bool (True/False)

2. Input & Formatting

input() always returns a string. If you need a number, you must convert it immediately using int() or float().

age = int(input("Age: "))
print(f"You will be {age + 1} next year.")

3. Control Flow (if/elif/else)

Make decisions using comparisons (==, !=, <, >). Always use == for checking equality!

if score >= 90:
    print("Grade: A")
elif score >= 80:
    print("Grade: B")

4. Loops (for & while)

Repeat actions without going insane.

  • Use for when you know exactly how many times to loop (e.g., iterating a list).
  • Use while when looping until a condition changes. Watch out for infinite loops!

Advertisement

Collections & Reusability

CollectionSyntaxKey FeatureUse When
List
[1, 2, 3]
Ordered, mutable, allows duplicates
Sequence of items
Tuple
(1, 2, 3)
Ordered, immutable
Fixed collection, dictionary keys
Set
{1, 2, 3}
Unordered, unique, O(1) lookup
Membership testing
Dict
{'a': 1}
Key-value pairs, O(1) lookup
Mapping keys to values
Lists

Lists ([]) are the easiest way to store multiple items. Remember that indexing starts at 0.

nums = [10, 20, 30]
print(nums[0])  # 10
Functions

Stop rewriting the same code! Use def to create reusable blocks of logic.

def greet(name):
    return f"Hi, {name}!"
Embrace the Errors

Python will yell at you with SyntaxError or ValueError. This is normal. Learning to read the Traceback is the real secret to mastering Python.


Next Steps

Practice

Write a program that asks for two numbers and prints their sum.

Experiment

Try dir([]) and dir({}) to see built-in methods.

Read Errors

When you get a SyntaxError or ValueError, read the traceback carefully — it tells you exactly what went wrong and where.
Continue Learning

Ready for the next step? Check out Setting Up Your Python Environment for virtual environments and package management, or jump to Python Tricks & Patterns for practical patterns that save time.

Python Fundamentals Beginners

You Might Also Like

Share this article:

Stay Updated

Get the latest posts delivered straight to your inbox.

Free Developer Utilities

Free In-Browser Developer Tools

Clean AI CLI logs, build cron expressions, decode JWTs, and calculate chmod permissions offline.

Explore Tools
Advertisement