Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s ="gigKKDKDMTsigj40jsjh-jfkmnsiofsmnlmbpdsldgmdgddggdkokokokkkkkklllleekgeg"
- def func(s, f=''):
- x = ''
- y = ''
- if f == 'longest':
- for i, elem in enumerate(s):
- if i == 0:
- x = elem
- continue
- if elem.lower() in x or elem in x:
- x += elem
- else:
- if len(x) > len(y):
- y = x
- x = elem
- return y
- elif f == 'alphanumerically_last':
- for i, elem in enumerate(s):
- if i == 0:
- x = elem.lower()
- continue
- if elem.isalpha() and ord(elem.lower()) > ord(x):
- x = elem.lower()
- return x
- elif f =='same_vowels':
- for i, elem in enumerate(s):
- if i == 0:
- continue
- if elem.lower() in 'aueoyiаеуоияюэ' and elem == s[i - 1]:
- return True
- return False
- print(func(s, 'longest'))
- print(func(s, 'same_vowels'))
- print(func(s, 'alphanumerically_last'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement