Hi Troy,
From your second message, I think you've already worked a few things out. In particular, you can't use cd
and dir
once you have python running in your terminal#. These are "shell" commands that you can use when python is not running. Once you have quit python (using exit()
), you can then use these shell commands.
To navigate to your Desktop folder (or whatever folder your script is in), you'll need to use the cd
command. For example, if your python script was in your Desktop folder, you would type into the shell cd C:\Users\[your user name]\Desktop
Your prompt in the terminal should now show that you're in the Desktop folder.
Once you're in the folder containing your script, to run it in the terminal, type python [your script name]
(e.g. python spuriousPredict.py
). You may need to change that to python3 [your script name]
depending on how python is setup on your computer. This should run your script. If not, please let us know.
And regarding "How does a person know what to enter?" you can add some text as a prompt to the user in your input()
command. For example
word = input("Please enter your favourite word: ")
where the words in the brackets are the prompt that the user will see.
I hope that helps. Please let us know if you have any other questions.
#Just as a footnote, and perhaps as an aside here: python has equivalents of cd
and dir
that you can use within python. When running a script from within a terminal, whatever folder you were in when you started the script will be the "current working directory" when the script runs ("cwd" for short). If you use the os
package, you can get the cwd within python using os.getcwd()
(e.g. print(os.getcwd())
will print out what folder python is working in). Similarly, you can change directory within a script using the chdir()
function which is also part of the os
package. Just note that you'll need to import the package in your script using import os
before you can use those functions. There is an overview of what I've just written, with an example, here