I would like to check whether this "a" and "b" is in the userInput. For example: user were to enter "hello", It will say it is not a ab word. For example: if user were to type "bag", It will say that it is a ab word. For Example: If user were to type "age", it will say that it is not a ab word(because of the missing b).
I've tried many ways, which include using counter to count how many time the alphabet is inside the string. If the "a" and "b" is inside the string, it will print "inside", else if either one of them is not inside or both no inside, it will print "not inside"
Kindly help me out. I've tried but it can't seems to be working fine.
def tryword(x):
if x == '':
return 0
lastNum= x[-1]
if (lastNum == "a" and "b"):
return tryword(x[:-1]) + 1
else:
return tryword(x[:-1]) + 0
if recursiveWord >= 0:
print "inside"
else:
print" not inside"
print tryword("abcdef")