input: Write a function to rewrite the given JavaScript code in Python.
  
  function rewriteJSToPython(code: string): string
  assert rewriteJSToPython("let arr = [1, 2, 3, 4, 5];\narr.forEach(item => { console.log(item * 2); });") == ("arr = [1, 2, 3, 4, 5]\nfor item in arr:\n print(item * 2)")
  assert rewriteJSToPython("let arr = [10, 20, 30];\narr.forEach(item => { console.log(item / 2); });") == ("arr = [10, 20, 30]\nfor item in arr:\n print(item / 2)")
output: def rewriteJSToPython(code: str) -> str:
      lines = code.split('\n')
      arr_line = lines[0]
      arr_line = arr_line.replace('let ', '').replace(';', '')
      arr_line = arr_line.replace(' = ', ' = ')
      arr_line = arr_line.replace('[', '[').replace(']', ']')
      arr_line = arr_line.replace(';', '')
      arr_name = arr_line.split('=')[0].strip()
      arr_value = arr_line.split('=')[1].strip()
      forEach_line = lines[1]
      forEach_line = forEach_line.replace('arr.forEach(item => { console.log(', 'for item in ' + arr_name + ':\n print(')
      forEach_line = forEach_line.replace('); });', ')')
      return arr_line + '\n' + forEach_line