Python – Filter all uppercase characters from given list of tuples

When it is required to filter all the uppercase characters from a list of tuples, a simple iteration, a Boolean value, the ‘append’ method and the ‘isupper’ methods are used.


Below is a demonstration of the same −

my_list = [("PYTHON", "IS", "Fun"), ("PYTHON", "COOl"), ("PYTHON", ), "ORIENTED", "OBJECT"]

print("The list is : " )

my_result_list = []
for sub_list in my_list:
   my_result = True
   for element in sub_list:

      if not element.isupper():
         my_result = False

   if my_result:


print("The resultant list is : ")


The list is :
[('PYTHON', 'IS', 'Fun'), ('PYTHON', 'COOl'), ('PYTHON',), 'ORIENTED', 'OBJECT']
The resultant list is :


  • A list of tuples is defined and is displayed on the console.

  • An empty list is defined.

  • The original list is iterated over, and a Boolean value is set to ‘True’.

  • The list is again iterated and every element is checked to belong to upper case.

  • If not, the Boolean value is set to False.

  • The control breaks out of the loop.

  • Based on the Boolean value, the element is appended to the empty list.

  • This list is displayed as output on the console.

Updated on: 13-Sep-2021


Kickstart Your Career

Get certified by completing the course

Get Started