24 lines
638 B
Python
24 lines
638 B
Python
def sameType(n1: int, n2: int) -> bool:
|
|
return (n1 % 2 == n2 % 2) # אם שניהם זוגיים או שניהם אי זוגיים
|
|
|
|
def main_2ex():
|
|
n1, n2 = 2, 4
|
|
if sameType(n1, n2):
|
|
print(f'{n1} and {n2} are the same type')
|
|
else:
|
|
print(f'{n1} and {n2} are not the same type')
|
|
|
|
n1, n2 = 3, 7
|
|
if sameType(n1, n2):
|
|
print(f'{n1} and {n2} are the same type')
|
|
else:
|
|
print(f'{n1} and {n2} are not the same type')
|
|
|
|
n1, n2 = 5, 8
|
|
if sameType(n1, n2):
|
|
print(f'{n1} and {n2} are the same type')
|
|
else:
|
|
print(f'{n1} and {n2} are not the same type')
|
|
|
|
main_2ex()
|