• 0 Posts
  • 6 Comments
Joined 2 years ago
cake
Cake day: June 15th, 2023

help-circle

  • 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))
    


  • During a high school English class, we had a section on fairytales and their origins in old European folklore (think stories that inspired The Witcher, the gorier version of Cinderella, etc.)

    One of the assignments was to write our own short fairytales, but apparently I was the only person that got a memo that these should have a darker style and tone as well… I don’t remember the whole of what I wrote, only that it involved trying to kill a witch, if you failed you died, and the winning method was using a pencil (this was 3-4 years before John Wick).

    After I read it to the entire class… well if there wasn’t a whispered “WTF” to break the silence, there should’ve been.

    I think I got a B minus.