Fix: Ensure all skills are tracked as files, not submodules
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
def even_odd_count(num):
|
||||
"""Given an integer. return a tuple that has the number of even and odd digits respectively.
|
||||
|
||||
Example:
|
||||
even_odd_count(-12) ==> (1, 1)
|
||||
even_odd_count(123) ==> (1, 2)
|
||||
"""
|
||||
even_count = 0
|
||||
odd_count = 0
|
||||
for digit in str(abs(num)):
|
||||
if int(digit) % 2 == 0:
|
||||
even_count += 1
|
||||
else:
|
||||
odd_count += 1
|
||||
return (even_count, odd_count)
|
||||
Reference in New Issue
Block a user