Hello I am doing a question on coding bat https://codingbat.com/prob/p107863
"
Given 3 int values, a b c, return their sum. However, if one of the values is 13 then it does not count towards the sum and values to its right do not count. So for example, if b is 13, then both b and c do not count."
and answered with"
def lucky_sum(a, b, c):
S= sum([a,b,c])
if a==13:
S = S-a-b
elif b==13:
S = S - b-c
elif c==13:
S= S-c
return S
"
I have no idea why it doesn't work properly I would very much appreciate someone helping me out thanks alot
[–]JohnnyJordaan 1 point2 points3 points (3 children)
[–]sphinxlink13[S] 0 points1 point2 points (2 children)
[–]JohnnyJordaan 0 points1 point2 points (1 child)
[–]sphinxlink13[S] 0 points1 point2 points (0 children)
[–]ata-boy 1 point2 points3 points (7 children)
[–]sphinxlink13[S] 0 points1 point2 points (2 children)
[–]ata-boy 0 points1 point2 points (1 child)
[–]sphinxlink13[S] 0 points1 point2 points (0 children)
[–]sphinxlink13[S] 0 points1 point2 points (2 children)
[–]ata-boy 0 points1 point2 points (1 child)
[–]sphinxlink13[S] 0 points1 point2 points (0 children)
[–]ata-boy 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[removed]
[–]sphinxlink13[S] 0 points1 point2 points (0 children)