-
Notifications
You must be signed in to change notification settings - Fork 12
Python Environment
Python is an example of a high-level language; other high-level languages you might have heard of are C++, PHP, and Java. There are also low-level languages, sometimes referred to as machine languages or assembly languages. Machine language is the encoding of instructions in binary so that they can be directly executed by the computer. Computers can actually only execute programs written in machine language. Thus, programs written in a high-level language (and even those in assembly language) have to be processed before they can run.

Two kinds of programs process high-level languages into low-level languages: interpreters and compilers. An interpreter reads a high-level program and executes it, meaning that it does what the program says. It processes the program a little at a time, alternately reading lines and performing computations.
A compiler reads the program and translates it completely before the program starts running. In this case, the high-level program is called the source code, and the translated program is called the object code or the executable. Once a program is compiled, you can execute it repeatedly without further translation.
Many modern languages use both processes. They are first compiled into a lower level language, called byte code, and then interpreted by a program called a virtual machine. Python uses both processes, but because of the way programmers interact with it, it is usually considered an interpreted language.
There are three ways to use the Python interpreter:-
- Shell Mode
- Program Mode
- Activecode Interpreter
In shell mode, you type Python expressions into the Python shell, and the interpreter immediately shows the result. The example below shows the Python shell at work.
The >>> is called the Python prompt. The interpreter uses the prompt to indicate that it is ready for instructions. Working directly in the interpreter is convenient for testing short bits of code because you get immediate feedback. Think of it as scratch paper used to help you work out problems.
You can write an entire program by placing lines of Python instructions in a file and then use the interpreter to execute the contents of the file as a whole through Command Line (CLI). Such a file is often referred to as source code.
By convention, files that contain Python programs have names that end with .py . Following this convention will help your operating system and other programs identify a file as containing python code.
The command-line interface, sometimes referred to as the CLI, is a tool into which you can type text commands to perform specific tasks—in contrast to the mouse's pointing and clicking on menus and buttons.
The application or user interface that accepts your typed responses and displays the data on the screen is called a shell. The most common these days is the Bash shell, which is the default on Linux and Mac systems in the Terminal application. By default, Windows systems only include the anemic Command Prompt application (which is nowhere near the power of Bash). However, Microsoft has come a long way and introduce a new Bash Shell in Windows 10
Credits:- Command Line Primer for Begineers
Activecode interpreter allows you to execute Python code right in the text itself (right from the web browser). Although this is certainly not the way real programs are written, it provides an excellent environment for learning a programming language like Python since you can experiment with the language as you are reading.





