aboutsummaryrefslogtreecommitdiff
path: root/challenge-330/deadmarshal/python/ch2.py
blob: 4e18e8df30d41c462ef2a414f2176c5cc8c04f25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env python

def title_capital(s):
  words = s.split()
  arr = []
  for word in words:
    if len(word) < 3:
      arr.append(word.lower())
    else:
      arr.append(word.capitalize())
  return ' '.join(arr)

print(title_capital('PERL IS gREAT'))
print(title_capital('THE weekly challenge'))
print(title_capital('YoU ARE A stAR'))