Write a program to Arrange string characters such that lowercase letters should come first


Topic: Write a program to Arrange string characters such that lowercase letters should come first

Solution

str1 = "PyNaTive"
lower = []
upper = []
for char in str1:
    if char.islower():
        lower.append(char)
    else:
        upper.append(char)
sorted_string = ''.join(lower + upper)
print(sorted_string)



List all Python Programs