# level 5:Convert PascalCase string into snake_case(2019-11-30)
###### tags: `Codewars` `python`
Complete the function/method so that it takes CamelCase string and returns the string in snake_case notation. Lowercase characters can be numbers. If method gets number, it should return string.
Examples:
<pre>
# returns test_controller
to_underscore('TestController')
# returns movies_and_books
to_underscore('MoviesAndBooks')
# returns app7_test
to_underscore('App7Test')
# returns "1"
to_underscore(1)
</pre>
my code:
<pre>
def to_underscore(string):
string = str(string)
result = string[0].lower()
for i in string[1:]:
if i.isupper() == True:
result = result + '_' + i.lower()
else:
result = result + i
return result
</pre>