This exercise keeps telling me to refresh the page!


Guys, I am stuck at exercise 5: Reading Between the Lines

There are no syntax or code mistakes. When I press on Save and Submit Code, it keeps on telling:

"Oops, try again. Sorry, but I'm gonna need you to refresh the page! Don't worry your code is saved."

And in the console, it says:

Traceback (most recent call last):
File "python", line 1, in
IOError: [Errno 2] No such file or directory: 'text.txt'

This should actually give me the first three lines of text.txt in seperate lines.

I am sure there is no problem with my code:

my_file = open("text.txt", "r")
print my_file.readline()
print my_file.readline()
print my_file.readline()

Replace this line with your code.


There are two(2) suggestions out of this.

One is to go over to text.txt and write, say "Success!"

Another is to go above your code and do:

with open("text.txt", "w") as textfile:

which opens text.txt and writes "Success!"

N:B - Ensure you're on the tab before clicking on "save and submit"

I hope this helps!


Thank you so so so so so so so so so so muuuuuuuccccchhhhhhh!!!!!!!!!!!!

You are great. The first one worked, I just went to text.txt and typed in success!

Thanks Thanks

:smile: :smile: :smile: :smile: :smile:


You're welcome. And such feedback is heartwarming.

Have fun coding! :slight_smile:


With pleasure :smile:


I compleeeeeeeeeeeeeeeeeteeeeeeeeeedddddddddddd PPPYYYYTTTHHOOOONNNNNN!!!!!!!!!!!!!!!!!


So happy, so happy. @bayoishola20 Thanks for helping me.


You're super welcome. :slight_smile:

You should get your hands "dirty" with more practice, and maybe, projects. :wink:


You know, I can't afford codecademy's pro and do the final project. I like codecademy and love programming. I really need to get all those quizzes and stuff but I can't do anything about that so I will look forward to programming on my own. :slight_smile:


Okay, that's fine.

You could try HackerRank for more practice.


Thanks Thanks for the link. :smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.