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

*args & **kwargs

Level 36 of 50 · Functions

Level 36 of 50

*args & **kwargs

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

📒 Open the cheat sheet
SanaCousin's shaadi! So many salami envelopes to count!
TeacherDon't know how many? *args takes them all!
salami.py
def salami(*gifts):
    print(gifts)

salami(500, 1000, 5000)
TeacherOne star collects every value you pass!
SanaWhat does the * actually do?
TeacherIt packs them into a tuple! 2 gifts, or 200!
guest.py
def guest(**info):
    print(info)

guest(name="Hamza", city="Pindi")
TeacherTwo stars? Named values, packed into a dictionary!

⏸ Pause & predict: what prints?

def f(*args):
    print(len(args))

f(5, 10, 15)

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.