code: def convert(s, num_rows):
      if num_rows == 1:
          return s
  
      n = len(s)
      res = ""
      cycle = 2 * (num_rows - 1)
  
      for i in range(0, num_rows):
          steps = cycle - 2 * i
          if (i == 0) or (i == num_rows - 1):
              # if first or last row, make a whole cycle
              steps = cycle
  
          j = i
          while j < n:
              res += s[j]
              j += steps
              if (i > 0) and (i < num_rows - 1):
                  # change the steps if not first or last row
                  steps = cycle - steps
  
      return res
  
label_desc: Use image node_id 1 for calling a global function with example usage: convert(s, num_rows) and returns: res, s