How to use f-strings to distribute tuple values versus .format

Viewed 26

So I just learned about f-strings, and I like how efficient they can be, but I was wondering if there's a way I can use them to replicate something I do for some extremely simple code (mostly just math calculations for myself):

Say I have a function that returns a tuple:

def add(a, b):
   return a, b, a+b

I can then use that in a print statement with .format and * to distribute the contents of the tuple:

print("The sum of {} and {} is: {}".format(*add(1,2)))

Is there a way I can replicate this with an f-string?

0 Answers
Related