## Monday, May 17, 2021

Solution Exercise 28: Python program which determines the list of words containing at least one capital letter #### Exercise 28

Write a Python algorithm that determines the list of words containing at least one capital letter in a given T text.

#### Solution

``````# creation of a function which tests if a word contains a capital letter or not
def containsUppercase (word):
# initialize a counter
counter = 0
for x in word:
if (x.isupper()):
counter = counter + 1
if counter == 0:
return False
else:
return True

def listWordWithMaj (T):
# initialization of the list of words containing a capital letter
listMaj = []
# Convert T to a list
L = T.split ()
for word in L:
#calling the function above to test if the word contains a capital letter
if containsUppercase (word):
listMaj.append (word)
return listMaj
# Example
T = "laravelFramework is a PHP framework that works with mySql"
print (listWordWithMaj (T)) # print: ['laravelFramework', 'PHP', 'mySql']``````

Younes Derfoufi
my-courses.net

## Python Exercises With Solutions

1. Python Arithmetic Exercises
2. Equations & System Of Equations
3. Polynomials and Functions
4. Python Arithmetic Exercises
5. Numpy, Matplolib, Sympy , Scipy - Exercises
6. Python Arithmetic Exercises

Younes Derfoufi

## Sample Text 