PyCharm can do a lot more than we will need. I am emphasizing a few simple things for us to open/save/run simple single-file programs.
The features overlap a lot with IntelliJ's Java environment, Idea, which we will use later.
After you have downloaded and opened PyCharm, you get a number of options for the next step. One is to Open a folder, in the list on the right. Click on that and navigate to the folder where you want to open and save programs. If you have used PyCharm before, you can also choose from existing work in the left column.
If you opened a folder, PyCharm should show the files in the directory in the left pane. You can select an existing Python file, or (for the first time!) create a new one:
Edit your file to make a (simple) Python program.
To run your file, there are two choices:
When you run, you should see a new pane in the bottom of the screen with a bottom Run tab highlighted. There you will get what the program prints, and it is where you enter your responses to input statements, interleaved, in execution order.
You can hide/expose the pane by clicking on the Run tab at the bottom of the screen.
A very useful feature in Python environments (other than the browser one you have been using) is a Python Console or Shell pane. You can make it be the pane across the bottom of your PyCharm screen by clicking on the bottom tab: Python Console.
This is best described starting with an illustration. In the Python Console pane you should see:
>>>
This is the prompt for you to enter something on that line. Enter on that line
2+3
and press return. You should now see:
>>> 2+3 5 >>>
The console evaluated your expression, wrote the value, and gave you another prompt. You can keep this up as long as you like: expression, automatic evaluation, printed, prompt for a new one ...
You can also enter assignment statements after the prompt, like:
>>> x = 3
It does not immediately print a value, since the variable holds the value. If you want just the assiged variable's current value, enter just its name (no assignment) after the prompt:
>>> x = 3 >>> x 3 >>>
There x is an expression that the console evaluates (to 3, and prompts again...)
Now continue after the prompt with
>>> y = x + 7 >>>
After the next prompt evaluate y:
>>> y = x+7 >>> y 10 >>>
Variables you introduce are global variables in the console that you can use, manipulate and change the value of, just like in a program.
The console is very forgiving. If you enter something illegal, it gives an error message, but previous definitions remain. You can fix your error and continue.
This is great place to briefly test out the behaviour of a method or function that you are not sure about!
What the console is not: You cannot just copy multiple lines directly into a regular program in one step:
One reason we introduce PyCharm now is that you are dealing with file methods. You cannot create files in the browser version of Python, but all the file methods work in the folder you are working in for PyCharm. When you create a new file in this folder, you should see it listed in the left pane's folder contents. If you named it ending with ".txt", PyCharm can also open it, so you can see that the correct stuff was written.