Divide a string in N equal parts | Function to print n equal parts of string ; Check if string can be divided in n equal parts ; Calculate the size of parts to find the division points ; Driver program to test the above function Length of string is 28 ;  ; Print 4 equal parts of the string
def divideString ( string , n ) : NEW_LINE INDENT str_size = len ( string ) NEW_LINE if str_size % n != 0 : NEW_LINE INDENT print " Invalid ▁ Input : ▁ String ▁ size ▁ is ▁ not ▁ divisible ▁ by ▁ n " NEW_LINE return NEW_LINE DEDENT part_size = str_size / n NEW_LINE k = 0 NEW_LINE for i in string : NEW_LINE INDENT if k % part_size == 0 : NEW_LINE INDENT print   " NEW_LINE DEDENT DEDENT DEDENT " , NEW_LINE INDENT print i , NEW_LINE k += 1 NEW_LINE DEDENT string = " a _ simple _ divide _ string _ quest " NEW_LINE / * length od string is 28 * / NEW_LINE divideString ( string , 4 ) NEW_LINE