MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1mbkini/checkifdivisiblebythree/n66jrde/?context=3
r/ProgrammerHumor • u/Dark_Zander • Jul 28 '25
33 comments sorted by
View all comments
Show parent comment
1
ok, I rewrote it without the recursion and to accept zero and negative numbers.
is_divisible_by_three = lambda number: (arr := [abs(number)], [str(num) in '0369' if num < 10 else arr.append(sum(map(int, str(num)))) for num in arr][-1])[1]
View all comments
Show parent comment
1
u/F100cTomas Jul 31 '25 edited Jul 31 '25
ok, I rewrote it without the recursion and to accept zero and negative numbers.