I'm trying to write a python program to check if the positive integer divisable by 2 and return false or true with using classes and functions. I'm getting this error: AttributeError: 'powerOfTwo' object has no attribute 'x'. Can you help me with fixing this?
class powerOfTwo():
def __init__(self, x):
self.x = x
def user(self):
x = int(input("Enter a number: "))
def check(self):
if self.x == 1:
return False
elif (x > 0) and (x % 2 == 0):
return True
else:
return False
a = powerOfTwo(5)
powerOfTwo().user()
powerOfTwo().check()
elif (x > 0) and (x % 2 == 0):->self.x- h4z3