'"Replace capital letters in a string with "_lower case letter" and print the output" does not work
For some reason following code does not work. The first part of if statement seems to work. Any ideas on what is the problem with the code?
sentence_input = str(input())
a = "_"
string = ""
if sentence_input.islower():
print(sentence_input)
else:
character_list = list(sentence_input)
for i in character_list:
if i.isupper():
i.replace(i, a + i.lower())
print(string.join(character_list))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
