For this Question: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)

P.......A........H.......N
..A..P....L....S....I...I....G
....Y.........I........R
And then read line by line: PAHNAPLSIIGYIR
Write the code that will take a string and make this conversion given a number of rows.The first line of input contains an integer denoting the number of rows n.
The second line contains a string denoting the given string.

Constraints:
1<= Length of string <= 1000
1 < = n < = 10Output the converted zigzag string in a single line.Sample Input:
2
ABCD

Sample Output:
ACBD

A....C
...B....D
and hence the answer would be ACBD., I have written this Solution Code: def convert(A, B):
        if B <= 1 :
            return A
        res = ""
        n = len(A)
        for i in range(B) :
            for j in range(i, n, 2*(B - 1)) :
                res += A[j]
                if i > 0 and i < B - 1 and j  + 2 * (B -1 - i) < n:
                    res += A[j + 2 * (B - 1 - i)]
        return res

n=int(input())
s=input()
print(convert(s,n)), In this Programming Language: Python, Now tell me if this Code is compilable or not?