gOOGLE cASE of a given sentence | Python3 program to convert a sentence to gOOGLE cASE . ; empty strings ; convert input string to upper case ; checki if character is not a space and adding it to string w ; converting first character to lower case and subsequent initial letter of another word to lower case ; Driver code
def convert ( str ) : NEW_LINE INDENT w = " " NEW_LINE z = " " ; NEW_LINE str = str . upper ( ) + " ▁ " ; NEW_LINE for i in range ( len ( str ) ) : NEW_LINE INDENT ch = str [ i ] ; NEW_LINE if ( ch != ' ▁ ' ) : NEW_LINE INDENT w = w + ch ; NEW_LINE DEDENT else : NEW_LINE INDENT z = ( z + ( w [ 0 ] ) . lower ( ) + w [ 1 : len ( w ) ] + " ▁ " ) ; NEW_LINE w = " " ; NEW_LINE DEDENT DEDENT return z ; NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT str = " I ▁ got ▁ intern ▁ at ▁ geeksforgeeks " ; NEW_LINE print ( convert ( str ) ) ; NEW_LINE DEDENT