Answer to Question #238049 in Python for Anil

Question #238049

Given a string in camel case, write a python program to convert the given string from camel case to snake case.


1
Expert's answer
2021-09-16T12:59:48-0400
def convert_to_snake_case(str1):
    f = True
    for c in str1:
        if f:
            result = c.lower()
        elif c.isupper():
            result +=  c.lower()
        else:
            result += c
        f = False
    return result




if __name__ == '__main__':
    str1= input().strip()
    print(convert_to_snake_case(str1))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS