Follow These Steps To Install Compiler & Interpreter
Finding an interpreter :-
Before we start Python programming, we need to have an interpreter to interpret and run our programs. There are certain online interpreters like https://ide.geeksforgeeks.org/, http://ideone.com/, or http://codepad.org/, https://jdoodle.com that can be used to run Python programs without installing an interpreter.
- Windows: There are many interpreters available freely to run Python scripts like IDLE (Integrated Development Environment) that comes bundled with the Python software downloaded from http://python.org/.
- Linux: Python comes preinstalled with popular Linux distros such as Ubuntu and Fedora. To check which version of Python you’re running, type “python” in the terminal emulator. The interpreter should start and print the version number.
- macOS: Generally, Python 2.7 comes bundled with macOS. You’ll have to manually install Python 3 from http://python.org/.
After Installing Start coding with Python:-
To start your work, you need the following tools:
- an editor which will support you in writing the code (it should have some special features, not available in simple tools); this dedicated editor will give you more than the standard OS equipment;
- a console in which you can launch your newly written code and stop it forcibly when it gets out of control;
- a tool named a debugger, able to launch your code step by step and allowing you to inspect it at each moment of execution.
- Knowledge of any programming language can be a plus or start it as a first programming language.
- Installed IDLE( Integrated Development and Learning Environment) to practice code.
IDLE appears like this
How to Write, Run & Debug code in Python
- The first step is to create a new source file and fill it with code. Click File in the IDLE’s menu and choose New File. The opened file is the editor window.
- Click File (in the new window), then click Save as..., select a folder for the new file (a desktop is a good place for your first programming attempts), and chose a name for the new file.
- To Run code just write like this print(“Welcome to a new Developer”) in editor and press run
Note: don’t set any extension for the file name you are going to use. Python needs its files to have the .py extension, so you should rely on the dialog window’s defaults. Using the standard .py extension enables the OS to properly open these files.
Try it with our compiler!
- Comments are the sentence but not code used to explain the code
- Comments can also be used to make code readable and also understandable
- Comments can be used to test our code
#This is single line comment
print("Hello!")#i'm commenting for my understand
This Multiline comment
This is also Multiline comment