Why isn’t the lesson accepting what I write to the file?


#1

Question

Why isn’t the lesson accepting what I write to the file?

Answer

Be sure not to add any additional spaces or punctuation or unnecessary text to the output file since Codecademy checks for exactly what is asked for. A common error is using string formatting and putting a space between the current for loop variable being written and the newline character, \n.
To fix this, simply remove any spacing you wrote and just write() the current number and the newline character directly afterward.


Learn Python - File Input / Output - Writing