Introduction, What is Python? and Basic Arithmetic: Python Tutorial

Introduction, What is Python? and Basic Arithmetic: Python Tutorial

Hello , What is Python?Python is a programming language. It was created by Guido van Rossum.

Guido van Rossum startedimplementing Python as a Hobby project in 1989 christhmas holidays. Python is namedafter a BBC comedy show: Monty Python’s Flying Circus.The language is not named after this wonderful snake. To get Python, Go to and download and install the latest version of Python.Python is free software.

I am using Python 3.5.0.The very latest version. Python is a simple and very powerful general purpose computerprogramming language.

If you want to learn programming or if you have never programmedbefore, then learning Python is a very good idea.

Python is very easy to learn comparedto other languages or Python programs are very readable. This is my Ubuntu GNU/Linuxoperating system desktop or my desktop. To open Python, open Terminal, the command lineshell of linux.

Press CONTROL, SHIFT and PLUS couple of times to zoom in the window or youcan go to the menu – View on top and click on zoom in and type python3 and hit enterkey. “>>>” is called a “chevron” and we can understand by seeing a cursor blinkingafter a “chevron” that we are in the Python Interpreter. If you are on a Mac, you canopen Python from Terminal.

If you are on a Windows machine, I strongly recommend forusing Python IDLE, the Integrated Development Environment of Python which is avaliable

You can also use any Text Editor or any IDE of your choice.Hello World Program This is the first program we write, when weare learning a new programming language. This program is simply telling the computer todisplay the text “Hello World!” on the screen.

Type : print(‘Hello World’) and hitEnter Key. “Hello World” should be in quotes. We can see ‘Hello World!’ printed on the screen.Welcome to the world of Python Programming or programming in general if you have neverprogrammed before.

In the above program line, print() is a function and ‘hello world’ isa string. Let’s try the same print function with some other string. print(‘Hot Coffee!’)see! Hot Coffee! is printed.What if we want to store the Hello World program in the secondary memory or hard disk, so thatwe can use it again in the future.

In the terminal I am typing nano Program File Extension is .py. I am using a simple text editor called nano tomake the hello world program.

Simply type print(‘Hello World’)save and exit from the nano editor. To save press control and x and then press y for command is for listing the directory. We can see the hello_world program in the directoryor by GUI we can see the new file in the folder.

I am opening it in Gedit text editor so thatyou can see. I am going to execute the Python program we just wrote. Type python3 space here Basic Arithmetic OperationsWithout Basic Arithmetic, Programming is nothing.

But believe me it’s not that difficult. Let’sopen Python Interpreter again, 15 + 23 and hit Enter key. see the answer printed back.This is arithmetic addition operation let’s do subtraction50 – 30 the answer is 20Multiplication 2 * 6we use asterisk or star symbol for multiplication What if we are using **?2 * 3 is 6. But 2 ** 3 is 8.

This is called the exponentiation operation. or 10 ** 4 is 10000 or 10 raised to the power 4 is 10000. Division15/6 is 2.5. Modulo DivisionWhat is 15%6 ? it is 3 because that is the remainder afterthe division. Note that it is not slash but the percentagesymbol.

Let’s do one more,25 % 7 and the answer is 4.Let’s Review Python is a Programming Language.Creator is Guido van Rossum. Named after a BBC comedy show.Hello World Program in Python is print(‘Hello World!’)Python program file extention is .py Basic Arithmetic Operations we just learn edare Addition Subtraction Multiplication Division Exponentiation and Modulo Division If you have any doubts please put those inthe comments below.

About: AbbasSheikh