I have been trying to run this code but this is the output

Ok better, but its not pre-formatted text yet.

See this for host to post code: About the Python Help category

Please edit the post so that it is pre-formatted text.