

2·
2 months agoGahh, serves me right for blindly writing code on my phone!
Gahh, serves me right for blindly writing code on my phone!
Functions in Python can only return a single value. While you are allowed to comma-separate additional values, as you have done, they are combined into a single tuple object that wraps the intended values.
As such, your splitter function is returning a single tuple containing three strings. Your calculate function is expecting three individual arguments (I’m guessing that the error trace mentions this).
To get around this, you can use the splat/asterisk operator to “unpack” the items from the tuple:
a, b, c = splitter(expression)
# or, inline
calculate(*splitter(expression))
Edit: removed bad asterisk
I use it mainly for code completion, and it’s great until I hit <tab> to indent and accidentally accept a 50 line suggestion.