First, positional vs keyword arguments
Positional arguments are matched by their position (order).
def intro(name, age):
print(name, "is", age, "years old")
intro("Sridhar", 26) # Sridhar is 26 years old
intro(26, "Sridhar") # 26 is Sridhar years old
The first value goes to name and the second goes to age. Swap the order and you get the wrong result.
Keyword arguments are matched by their name, so the order doesn't matter.
intro(name="Sridhar", age=26) # Sridhar is 26 years old
intro(age=26, name="Sridhar") # Sridhar is 26 years old
You can mix the two, but positional ones must come first:
intro("Sridhar", age=26) # works
intro(name="Sridhar", 26) # SyntaxError: positional argument follows keyword argument
Normally Python lets you pass an argument either way. The / and * symbols let you force one style.
/ → positional-only arguments
def calculate(a, b, /):
print(a + b)
calculate(10, 20) # works, prints 30
calculate(a=10, b=20) # TypeError
Anything before / has to be passed by position. You can't use the name.
* → keyword-only arguments
def calculate(a, *, b):
print(a + b)
calculate(a=10, b=20) # works
calculate(10, b=20) # works
calculate(10, 20) # TypeError
Anything after * has to be passed by name.
Quick way to remember it:
-
/→ "everything before me is positional only" -
*→ "everything after me is keyword only"
Functions can return things
def play():
teamA = 300
teamB = 290
if teamA > teamB:
return "Winner Trophy"
else:
return "Runner Trophy"
hand = play()
print(hand) # Winner Trophy
return hands a value back to whoever called the function.
The career part
What I took away from it:
- AI tools (Claude, Copilot, etc.) are making some jobs easier, but companies still want people who understand code, not just people who can generate it.
- Interviews still test flow charts, pseudocode and algorithms. Logic matters more than syntax.
- Build proof of your interest. Write blogs (that's why I'm on dev.to), go to tech meetups, talk to technical people.
- Learn the fundamentals properly (Python, Java, databases). That's what lasts.
So here I am, blogging.
Top comments (0)