![Python-courses-python-exercises-python-for-while](https://1.bp.blogspot.com/-T3BongcoJFo/X4CftQxVL8I/AAAAAAAAB5U/Lf59WgNyhGo2FdogKqxv0PIy_Ef7XDPdgCLcBGAsYHQ/s0/my-python-courses-python-exercises-with-solutions.png)
Exercise 46
Write a Python algorithm as a function which takes as parameter a string variable s and which returns the list of all uppercase characters found in s.
Solution
def listShift (s):
# initialization of the list of capital letters
l_maj = []
for x in s:
if x.isupper ():
l_maj.append (x)
return l_maj
# Example:
s = "Tkinter is the most popular GUI Pytnon Framework"
print (listShift(s)) # output: ['T', 'G', 'U', 'I', 'P', 'F']
Younes Derfoufi
my-courses.net
my-courses.net