![Python-courses-download-Python-courses-s-Python-courses](https://1.bp.blogspot.com/-T3BongcoJFo/X4CftQxVL8I/AAAAAAAAB5U/Lf59WgNyhGo2FdogKqxv0PIy_Ef7XDPdgCLcBGAsYHQ/s0/my-python-courses-python-exercises-with-solutions.png)
Exercise 27
Write a Python algorithm that determines the list of words starting with a capital letter in a given text T.
Solution
def beginMaj (T):
# initialization of the list of words that start with a capital letter
uppercase = []
# convert the text T to a list:
L = T.split ()
for word in L:
if (word [0].isupper()):
uppercase.append (word)
return uppercase
# Example
T = "Python is more power thant Java"
print (beginMaj(T)) # the output is: ['Python', 'Java']
Younes Derfoufi
my-courses.net
my-courses.net