title: Invalid Syntax error for small python txt file writing program
body: <p>I am trying to create / write to a txt file, however, the code I have obtained from <a href="https://www.guru99.com/reading-and-writing-files-in-python.html" rel="nofollow noreferrer">https://www.guru99.com/reading-and-writing-files-in-python.html</a> is not rendering.</p>
  
  <pre><code>def main():
  
  f = open("JTF.txt", "w+")
  
  for i in range(10)
      f.write("This is line %d\r\n" % (i+1))
  
  f.close()
  
  if __name__=="__main__":
      main()
  
  # The error i am receiving when I run the above code is as follows:
  #     def main()
  #             ^
  # SyntaxError: invalid syntax
  </code></pre>