So i am suppose to open a text file by >>>yyy('yyy.txt') and after inputing that python should find my file (which is does, since in the same directory) and edit all the words 'hot' to new word 'why not'. after editing the text file the content of the entire file should be printed.
Its opening the file and its editing 'hot' with 'why not' but it duplicates the whole text in the text file and it does not return anything on the python when i need the text to be displayed. 
Any help???
file.write() appends to the end of the file. You never clear the file after reading the contents. The simplest thing to do, probably, would be to read the file once in 'r' mode, then open it again in 'w' mode (which will clear the file), and write out the edited content.
The output doesn't print because you don't tell it to. Calling infile.readlines() on its own just reads the file, then discards the result. The final line should be print infile.readlines().
Python, opening the file, reading the file, editing the file, and priting the file string?