My homework assignment is to Write a program that reads a string from the user and creates a list of words from the input.Create two lists, one containing the words that con
You can use isupper method for your purpose:
text = 'sssample Text with And without'
uppers = []
lowers = []
# Note that loop below could be modified to skip ,.-\/; and etc if neccessary
for word in text.split():
uppers.append(word) if word[0].isupper() else lowers.append(word)
EDITED: You can also use islower method the following way:
text = 'sssample Text with And without'
other = []
lowers = []
# Note that loop below could be modified to skip ,.-\/; and etc if neccessary
for word in text.split():
lowers.append(word) if word.islower() else other.append(word)
OR depends on what you really need you can take a look at istitle method:
titled = []
lowers = []
for word in text.split():
titled.append(word) if word.istitle() else lower.append(word)
AND with simple if else statement:
titled = []
lowers = []
for word in text.split():
if word.istitle():
titled.append(word)
else:
lower.append(word)