class solution:
    # step = 1
    def convert(self, s, numrow):
        if numrow == 1:
            return s
        L=['']*numrow
        step = 1
        index = 0
        if numrow >=1:
            for x in s:                     # for循环后面有冒号:
                L[index] = L[index] + x
                if index == 0:
                    step = 1
                elif index == numrow-1:
                    step = -1
                index += step
            return ''.join(L)
sol = solution()
s = "LEETCODEISHIRING"
numrow = 4
sol.convert(s, numrow)
print(sol.convert(s, numrow))