I’ve a list ["ABC", "JAVA", "Python", "user", "CODE"] and I want the functions print out ["Python", "user"].
Here is my progress so far:
def no_upper(my_list : list):
new_list = my_list
for word in my_list:
if word.isupper():
my_list.remove(word)
return new_list
if __name__ == "__main__":
my_list = ["ABC", "JAVA", "Python", "user", "CODE"]
new_list = no_upper(my_list)
print(new_list)
>Solution :
If you objective is to "remove" words written entirely in capital letters:
lst = ["ABC", "JAVA", "Python", "user", "CODE"]
[x for x in lst if x != x.upper()]
OUTPUT
['Python', 'user']