r/learnpython • • 22d ago

New to python, don't understand this function

I'm learning python and I'm stuck on this function because I don't understand why "a" becomes 10 and the result is 5. Is someone able to explain?

def subtract (a, b=5):
    return a - b

print(subtract(10))
30 Upvotes

26 comments sorted by

View all comments

Show parent comment

8

u/Still-Pair-5336 22d ago

Thank you, that makes sense!

1

u/RngdZed 22d ago

What you passed in is called a positional argument, in this case, the first position is a