How To Work With The Python 3 Interactive Console on Windows 10
The interactive Python console (also called the Python interpreter or the Python shell) provides programmers with a quick way to execute commands and test or test the code without creating a file.
By providing access to all the built-in Python functions and any installed modules, command history and autocomplete, the interactive console offers an opportunity to explore.
This tutorial shows you how to work with the Python interactive console and use it as a programming tool.
- Basically, the interpreter executes commands line by line: you write a line, press Enter, the interpreter executes it, you observe the result.
This is very convenient when a person only studies programming or tests some small part of the code.
After all, if you work in a compiled language, you would first have to write the code in the source programming language, then compile it and then run the executable file for execution.
- The data is stored in the memory cells of the computer. When we enter a number, it is put into memory.
- But how do you know where?
- How in the future to access this data?
Previously, when writing programs in the machine language, access to the memory cells was done by specifying the registers. But with the advent of assemblers, when referring to data began to use the so-called variables.
The mechanism of communication between variables and data can vary depending on the programming language and data type. For now, it’s enough to remember that the data is associated with some name and in the future, they can be accessed by this name.
- In a Python program, the relationship between data and variables is established using the = sign. This operation is called assignment.
For example, the expression sq = 4 means that the sq (SQL) name is referenced to the object (data) in a specific memory area and should now be referenced by that name. Variable names can be any.
However, there are several general rules for writing them:
- It is advisable to give meaningful names to variables, indicating the purpose of the data they are referring to.
- The variable name cannot be the same as the language commands (reserved keywords).
- The variable name must begin with a letter or an underscore (_).
- To find out the value that variable references while in interpreter mode, just call it (write a name and press Enter).
In variables, you will store all the results while the program is running. Basically, a variable is a container where you can add some information to address it at the right time and make the necessary operation with it.
If you have configured a programming environment, you can run the environment and access the Python version and the modules installed into that environment. But if you missed that part where we have explained how to create and configure a programming environment of Python 3 on your Windows 10 computer then you should look at it first before proceeding with this tutorial.
What is going to be covered in the video:
- Entering the Interactive Console
- Working with the Python Interactive Console
- Multiple Lines
- Leaving the Python Interactive Console