I want to write a method which i can use with strings same like we use "word".isupper
return False
, "word".islower return True
, so I want to define a class and want to use like "word".isspecial()
so if i have a list of special characters :
special=["&","*",")("]
and I want that if I have a word I can check like ")(".method() and it return True as we do with "string".islower() which return True
I know I can do this with simple loop and in
operator but I want to know how I can do like ")(".method()
What I tried is buggy:
class Lower:
def check(self,x):
for i in lower:
if x==i:
return True
check1=Lower()
check1.check()
print(check1.check(special,")("))