def main()env gym make('spaceinvaders- 'env reset(episode_reward while trueaction env action_space sample(_rewarddone_ env step(actionepisode_reward +reward if doneprint('reward%sepisode_rewardbreak finallyrun the main function include __name__ check to ensure main only runs when you invoke it directly with python bot_ _random py if you do not add the if checkmain will always be triggered when the python file is executedeven when you import the file consequentlyit' good practice to place the code in main functionexecuted only when __name__ ='__main__/ataribot/bot_ _random py def main()if doneprint('reward %sepisode_reward