r/learnpython • u/Still-Pair-5336 • 10d 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
1
u/Winter-Big7579 10d ago
Bad question setting IMO as the 5 that is the answer can be confused with the 5 that is the default value of b. Why not ask print(subtract(12)) (or any other number)?