Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Created July 1, 2021 06:29
Show Gist options
  • Save Abhayparashar31/a5cd3323b9fb31731f1b375829924ace to your computer and use it in GitHub Desktop.
Save Abhayparashar31/a5cd3323b9fb31731f1b375829924ace to your computer and use it in GitHub Desktop.
class Check_number :
def even_or_odd(func) :
def check(self, num) :
func(self, num)
if num % 2 == 0 :
print(f'{num} is an EVEN Number')
else :
print(f'{num} is an ODD Number.')
return check
@even_or_odd
def is_even(self, num) :
print('Input : ', num)
obj = Check_number()
obj.is_even(63)
obj.is_even(22)
obj.is_even(71)
'''
Input : 63
63 is an ODD Number.
Input : 22
22 is an EVEN Number
Input : 71
71 is an ODD Number.
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment