Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # title case 6 kyu
- import string
- t1 = 'a clash of KINGS'
- t2 = 'a an the of'
- t3 = 'THE WIND IN THE WILLOWS'
- t4 = 'The In'
- t5 = 'the quick brown fox'
- def tc(string, *minor_words):
- if string == '':
- return ''
- dex = 0
- string = string.lower()
- minor_words = (''.join(list(minor_words)))
- mws = minor_words.split()
- parsed = string.title().split()
- print(mws)
- print(parsed)
- x = parsed.pop(0)
- for i in parsed:
- for m in mws:
- if i == m:
- g = parsed.index(i)
- print(g)
- parsed[g] = i.lower()
- # parsed = parsed.insert(0,post)
- parsed.insert(0,x)
- return ' '.join(parsed)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement