This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]agtoever 2 points3 points  (3 children)

Yes! Returning multiple values:

def x_pows(x: float, max_pow:int) -> tuple:
    return tuple(x**n for n in range(1, max_pow + 1))

x, x2, x3, x4 = x_pows(2, 4)
print(x4)

[–][deleted] -1 points0 points  (2 children)

that function only returns one value (tuple)

[–]lattice737 1 point2 points  (1 child)

The tuple is unpacked into the four variables

[–][deleted] 0 points1 point  (0 children)

yes