Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A student writes a program in Notepad and saves it as hello.py. Running it gives an error that the file cannot be found, and the file looks like hello with a small text icon. What is probably wrong, and how do you fix it?
A Python file must end in .py. Make the file extensions visible to see the real name.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
The problem. Windows hides the ending of known file types. The real name is probably hello.py.txt: Notepad added .txt when it saved. Python cannot find hello.py, because that name does not exist.
Fix.
hello.py..txt.Check. The program below tests some names. A name that ends in .txt is not a Python file.
Log in to join the discussion.
Loading…