Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. # title case 6 kyu
  2. import string
  3.  
  4. t1 = 'a clash of KINGS'
  5. t2 = 'a an the of'
  6. t3 = 'THE WIND IN THE WILLOWS'
  7. t4 = 'The In'
  8. t5 = 'the quick brown fox'
  9.  
  10. def tc(string, *minor_words):
  11. if string == '':
  12. return ''
  13. dex = 0
  14. string = string.lower()
  15. minor_words = (''.join(list(minor_words)))
  16. mws = minor_words.split()
  17. parsed = string.title().split()
  18. print(mws)
  19. print(parsed)
  20. x = parsed.pop(0)
  21. for i in parsed:
  22. for m in mws:
  23. if i == m:
  24. g = parsed.index(i)
  25. print(g)
  26. parsed[g] = i.lower()
  27. # parsed = parsed.insert(0,post)
  28. parsed.insert(0,x)
  29. return ' '.join(parsed)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement