title: How to dump function output to a .txt file?
body: <pre><code>def example():
      print(&quot;hello, world!&quot;)
  
  times = int(input(&quot;how many 'hello worlds'? &quot;))
  for c in range(times):
      example()
  </code></pre>
  <p>That's an example of what I'm trying to do.</p>
  <p>If I type &quot;3&quot; in the input, I want my .txt file to contain the output of the function I created, which is:</p>
  <pre><code>hello, world!
  hello, world!
  hello, world!
  </code></pre>
  <p>Is that possible? If so, how?</p>