Compare commits
1 Commits
master
...
abgabe_ueb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77772fb5dc |
10
src/same_case.py
Normal file
10
src/same_case.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# https://www.codewars.com/kata/5dd462a573ee6d0014ce715b
|
||||||
|
|
||||||
|
def same_case(a, b):
|
||||||
|
if not a.isalpha() or not b.isalpha():
|
||||||
|
return -1
|
||||||
|
|
||||||
|
if (a.islower() and b.islower()) or (a.isupper() and b.isupper()):
|
||||||
|
return 1
|
||||||
|
|
||||||
|
return 0
|
||||||
8
tests/test_same_case.py
Normal file
8
tests/test_same_case.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
from src.same_case import same_case
|
||||||
|
|
||||||
|
def test_same_case():
|
||||||
|
assert same_case('a', 'g') == 1
|
||||||
|
assert same_case('A', 'C') == 1
|
||||||
|
assert same_case('b', 'G') == 0
|
||||||
|
assert same_case('B', 'g') == 0
|
||||||
|
assert same_case('0', '?') == -1
|
||||||
Loading…
x
Reference in New Issue
Block a user