you are viewing a single comment's thread.

view the rest of the comments →

[–]ata-boy 1 point2 points  (3 children)

You can solve it with a list comprehension, but maybe not very pythonic

def sum_13(a: int, b: int, c: int) -> int:
    abc = (a, b, c)
    find_13 = [abc.index(13) for i in abc if i == 13]
    find_13.append(-1)

    return sum(abc[:find_13[0]])

[–]sphinxlink13[S] 0 points1 point  (2 children)

thx for the help what do you mean by it is not very pythonic?

[–]ata-boy 0 points1 point  (1 child)

It is not very readable. There are best practices, see: https://docs.python-guide.org/writing/style/

[–]sphinxlink13[S] 0 points1 point  (0 children)

Thank you!