8000 Solution for task: Array2Binary addition. · ZaytsevNS/python_codewars@94da568 · GitHub
[go: up one dir, main page]

Skip to content

Commit 94da568

Browse files
committed
Solution for task: Array2Binary addition.
1 parent 390eb5d commit 94da568

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

7KYU/arr2bin.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Solution for task: https://www.codewars.com/kata/559576d984d6962f8c00003c/
2+
3+
def arr2bin(arr: list) -> str or bool:
4+
if not arr:
5+
return '0'
6+
if any(type(i) != int for i in arr):
7+
return False
8+
else:
9+
return bin(sum(arr))[2:]

0 commit comments

Comments
 (0)
0