Search code examples
pythonshellcommandline

python shell and python


I am a super-beginner-level Python learner. I have installed Python recently, but when I clicked on the Python icon, like I normally do after installing something:

this icon here

It shows me this black box with white letters like this:

i think its called python(command line).

However, the guy in the tutorial tells me to open the file named IDLE (Python GUI), and it opens a python shell, with white box and black letters.

I wonder what is the difference between these 2 boxes and what will happen if I apply everything this guy teaches on the black box with white letters?


Solution

  • The black box with white letters is a python interactive shell. In there, you can only execute one line at a time. Like this:

    >>> num = 1+2
    >>>print(num)
    3
    

    That shows that you can only enter one line at a time. Now, the white box with black letters is called an editor, it means that instead of writing your code every time to run it, you can just save it to file. So, in the editor, you write code like this:

    num = 1+2
    print(num)
    

    Now you save it. Run it by pressing the F5 key. And it will open another box, just like the black one but its color will be white. This is also an interactive shell.

    So, in short:
    The black one is a console or interactive shell where you can only enter a single line of code at a time. And the editor is the white box where you write your code and save it. Then you can run your code as many times needed without typing it again.