thanks in advance for possibly helping me to solve the following problem...
It's my aim to separate strings from a list into two categories (upper- and lowercased) and give feedback wether an item is capitalized or not. Here is what I tried so far:
names = ["justin", "Noah"]
def check_upper(strings):
i = 0
uppercased_strings = []
lowercased_strings = []
for string in strings:
if string[i].isupper() == True:
print("String is uppercased!")
uppercased_strings.append(string[i])
i += 1
elif string[i] != True:
print("String is lowercased")
lowercased_strings.append(string[i])
i += 1
print(uppercased_strings, lowercased_strings)
check_upper(names)
But sad enough I get this output when running the script:
String is lowercased
[] ['j']
String is lowercased
[] ['j', 'o']
Aucun commentaire:
Enregistrer un commentaire