Write a python program to return a string such that the string is arranged from lowercase letters and then uppercase letters

In this article, we will write a python program to return a string such that the string is arranged from lowercase letters and then uppercase letters.

Write a python program to return a string such that the string is arranged from lowercase letters and then uppercase letters

#string functions
def lowerCase(sentence):
    lowerCaseLetters = []
    upperCaseLetters = []

    for letter in sentence:
        if letter.islower():
            lowerCaseLetters.append(letter)
        else:
            upperCaseLetters.append(letter)

    return ''.join(lowerCaseLetters + upperCaseLetters)


print(lowerCase("PYTHON sourcecodeexamples "))
print(lowerCase("SOURCE CODE EXAMPLES python "))

Output:

sourcecodeexamplesPYTHON  
pythonSOURCE CODE EXAMPLES




Comments