Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def x_ian(x, word):
- """
- Given a string x, returns True if all the letters in x are
- contained in word in the same order as they appear in x.
- >>> x_ian('eric', 'meritocracy')
- True
- >>> x_ian('eric', 'cerium')
- False
- >>> x_ian('john', 'mahjong')
- False
- x: a string
- word: a string
- returns: True if word is x_ian, False otherwise
- """
- if len(x)>len(word):
- return False
- if len(x)==0:
- return True
- else:
- if x[0]==word[0]:
- return x_ian(x[1:],word[1:])
- else:
- return x_ian(x,word[1:])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement