You are on page 1of 40

PYTHON LANGUAGE

Overview

• The author of python is Guido van Rossum.


• He is a big fan of British comedy movie called as Monty
python flying circus and that's why he name called as python
initially.
• why python is so famous as we have c, c++, java , java
script but still python is famous.
• python is so easy to understand it is much simpler than c , c+
+ and java.
• we have multiple version 1, 2 , 3 .
• Python Version 2 is very different from Version 3.
• Normally in case of version, language are backward compatible
with previous version but that is not case with python.
• Two different version have two different way of working.
Python is a programming language as you all know.
But its also interpreted , object oriented and High level Language.
It supports procedural programming as well as object oriented programming.

Python came into picture in 1989 and java came into picture in 1995 so it is not a new language.

Most of the company uses python:


Like Google, YouTube, Yahoo, NASA as a main language or as supportive language.

we have big website called Reddit is today written in python.


And like google has so many features are coding using python.
What is interpreter and why we call as General purpose language ?
Interpreter : It converts you code into binary form.
General purpose language : We can use many areas like

IDL (Integrated Development Environment) this is place where we write a code, run and debug it.
Notepad we are trying to do operation but not getting result.

Because we don’t have interpreter for notepad.

Lets check if we have python interpreter by default in our system.


Answer is not we don’t have.

lets install python interpreter.


https://www.python.org/downloads/
Let try now with python prompt. Its look like given below.

We can use pycharm IDE for professional Developers for complex project.
Variable
name = “YOUTUBE”

We can not change the value that’s mean string is immutable


LIST in python
List contain numbers of values or string.
We want to group them together.
It is mutable means we change the value.
Declaration of list [].
Tuple and set
Tuple is almost same as list we have collection of value there.
Only the difference is, in list we can change value but in tuple we can not change values.
It is immutable.

Where to use tuple ?


In some of the project if you don’t want to change the grouped value we can use tuple.
Since we don't change the value in tuple so iteration is faster as compare to list.
And it enhance the speed of execution than a list.
Declaration of () bracket is for tuple.

Set is a collection of unique elements. Declaration of {} bracket is for set.


Set uses a concept of hash and it doesn’t support proper sequence so
Index will not support in set and It don’t support dublicate value.
Basic example of Tuple and set
Dictionary in Python
List is a collection of elements and order in sequence.
Set is same as list but it doesn’t maintain the sequence.
But Dictionary has keys and value concepts.
More on Variables
Data Types of python
How to get type of variable ?
Operators in Python
What is relational Operator ? a=5 b=6
Where we can compare two number.
Combine two relational operator using logical operator based on condition
Binary Octal Decimal Hexadecimal
Number system conversion in Python
How to swap two numbers in Python ?

Not swap Using extra variable Wasting extra one bit Using xor save one bit

Swapping in Python But how ?


It goes into Stack and we have concept called
ROT_TWO()
Swaps the two top-most stack items.
Bitwise Operators
Import math functions
Math is a module in which we have functions.
In math module we have ceil and floor
concepts.
Ceil will give the highest integer value.
Floor will give the least integer value.
We have alias facility we can provide user define name
to particular module

If we don’t want to import math module and want to use functions


Pycharm Run Debug
As of now we were using Interactive console.
Let see how to use Pycharm for complex environment.
Below is pycharm console view.
We can set Breakpoints to Debug particular piece of code.
By using f8 key we can see special variable.
User Input in Python
Input is inbuilt function. And user has to pass input to do this operation.
Commands like :
help> LISTS
help> (‘LISTS’)
Help> quit

Thankyou

You might also like