Python - Filtering Lowercase Words/Elements From List
by matt392 in Circuits > Software
14 Views, 0 Favorites, 0 Comments
Python - Filtering Lowercase Words/Elements From List

def filter_lowercase_from_list(list): # set up internal list ListInsideFunction = [] for element in list: # Check to see if the element has all lowercase letters if element.islower(): # If all are lowercase letters, append element to list ListInsideFunction.append(element) return ListInsideFunction LinuxList = ["antix", "mxlinux", "gentoo", "Debian", "mint", "Kali", "LXLE", "manjaro", "Arch"] print ("LinuxList is:", LinuxList) print ("========") # Call the function and place results into variable LowercaseElements LowercaseElements = filter_lowercase_from_list(LinuxList) print ("The lowercase elements from the LinuxList are:", LowercaseElements)