Skip to content
← Python for AI/ML · all 50 levels

Default & keyword args

Level 35 of 50 · Functions

Level 35 of 50

Default & keyword args

explained with mobile load. Watch the reel, then work through it below: run the code, take the quiz, keep the cheat sheet.

📒 Open the cheat sheet
SanaEvery recharge, the shopkeeper asks: which network? It's ALWAYS Jazz!
TeacherThen make Jazz the default! Python lets you!
load.py
def load(rs, net="Jazz"):
    print(rs, "on", net)

load(100)
TeacherSkip the network, and Jazz fills in by itself!
SanaWait, what's the = doing up there?
TeacherThat's the default! Used only when you don't pass one!
load.py
def load(rs, net="Jazz"):
    print(rs, "on", net)

load(net="Zong", rs=200)
TeacherAnd keyword arguments? Name them, and the order doesn't matter!

⏸ Pause & predict: what prints?

def bill(amt, tip=50):
    print(amt + tip)

bill(500, 100)

Where this leads

Python is step one. Building AI that ships is the rest.

The diploma takes you from zero to deployed computer vision, LLM and agent projects, with engineers who build them for a living. Already code? The bootcamp does it in three months.