Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
In a terminal, a student types python hello.py and gets an error that the file cannot be found. The file is in the folder Documents. What should the student do? Which commands help?
The terminal looks for the file in its own folder. Use cd to go to the folder of the file.
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, compare your working with the solution.
The terminal is probably in a different folder from the file.
cd Documents.dir on Windows, or ls on macOS and Linux.python hello.py (or py hello.py on Windows, or python3 hello.py on macOS and Linux).Answer: use cd to go into the folder, check with dir or ls, and run it again.
Log in to join the discussion.
Loading…