Algorithm or solo code of this program: def square_free(n): x = “…

Question Answered step-by-step Algorithm or solo code of this program: def square_free(n): x = “… Algorithm or solo code of this program:def square_free(n):   x = ” 1″   #first element must be on first index as instructed . Therefor here a space is used at index 0.   string = ” ”   #string to be returned   for _ in range(0,n):   #n times loop       string = ” ”       for i in range(1,len(x)):           if i % 2 ==0:      #if the position of element is “even”               if x[i] == “1”:                   string += “321”               elif x[i] == “2”:                   string += “132”               elif x[i] == “3”:                   string += “231”           else:                     #if the position of element is “odd”               if x[i] ==”1″:                   string += “123”               elif x[i] == “2”:                   string += “231”               elif x[i] == “3”:                   string += “312”       x=string   return string.strip()print(square_free(3)) Computer Science Engineering & Technology Python Programming ITECH 1400 Share QuestionEmailCopy link Comments (0)