exec_code = compile(""" req = input('Count how many numbers? ') for eachNum in range(req): print eachNum """, '', 'exec') exec exec_code