code: def generate(num, prompt_default=True):
      
      p = Problem(num)
  
      problem_text = p.text
  
      msg = "Generate file for problem %i?" % num
      click.confirm(msg, default=prompt_default, abort=True)
  
      # Allow skipped problem files to be recreated
      if p.glob:
          filename = str(p.file)
          msg = '"{}" already exists. Overwrite?'.format(filename)
          click.confirm(click.style(msg, fg='red'), abort=True)
      else:
          # Try to keep prefix consistent with existing files
          previous_file = Problem(num - 1).file
          prefix = previous_file.prefix if previous_file else ''
          filename = p.filename(prefix=prefix)
  
      header = 'Project Euler Problem %i' % num
      divider = '=' * len(header)
      text = '\n'.join([header, divider, '', problem_text])
      content = '\n'.join(['"""', text, '"""'])
  
      with open(filename, 'w') as f:
          f.write(content + '\n\n\n')
  
      click.secho('Successfully created "{}".'.format(filename), fg='green')
  
      # Copy over problem resources if required
      if p.resources:
          p.copy_resources()
docs: Generates Python file for a problem.