Python Free Tutorial

Python interpreter is usually installed at /usr/local/bin/python3.# on linux and in C:\Program Files\Python37\ on windows devices. We can write the program using text editor like gedit, vim, Jython, IronPython, IDLE, ActivePython,Wing IDE, pydev, etc. The interpreter is said to be in interactive mode when interpreter displays its copyright message and presents the userwith the >>> prompt. For continuation lines it prompts with the (…) secondary prompt.

$ python
Python 3.8.1 (default, Jan  8 2020, 22:29:32) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

In the interactive shell, we can execute the valid statement or sequence of statements and can instantly execute and view the output.

>>> 5 + 7

Python source files are ordinary text files and normally have a .py suffix. Python source files are treated as encoded in UTF-8. For debugging, it is better to run the program within a Python development tool such as IDLE. To execute the .py file, you can enter the command on interpreter/terminal as follows:

$ python <filename>.py # example : python firstprogram.py

Let’s try some simple Python commands. Start the interpreter and wait for the primary prompt,>>>. “Hello World” is the first program programmer does after setting up their environment for the first time to verify r that the environment is set up and working.

Let’s break our above code. print ( ) function is the built-in function in Python 3 is used to prints the specified message and other standard output whatever we put inside the parenthese ( ) to the screen. This function are always available for us to use in programs that we created which tells the computer to perform certain task.

Within, the print ( ) function’s parentheses are a sequence of characters “Hello World” which is enclosed inside the quotation marks. Thus, we can say that any character that is enclosed inside the quotation marks are called a string .

What is Python Interpreter?

This is the program that knows how to translate or interpret our Python code into instructions that a computer can understand.First it executes line 1 then , moves on line 2 and so on. So this is how python programs get executed.

Example : Program to add two numbers

This page is contributed by Diwas & Sunil . If you like AIHUB and would like to contribute, you can also write an article & mail your article to  itsaihub@gmail.com . See your articles appearing on AI HUB platform and help other AI Enthusiast.

About Diwas Pandey

Highly motivated, strong drive with excellent interpersonal, communication, and team-building skills. Motivated to learn, grow and excel in Data Science, Artificial Intelligence, SEO & Digital Marketing

View all posts by Diwas Pandey →


Leave a Reply

Your email address will not be published.