PYTHON Introduction Points…….. • Python is recommended as the first programming language for beginners. • Python was developed by Guido Van Rossam in 1989 at NRI at Netherlands. • Python was named based on T.V. show “The Complete Monty Python’s Circus” of BBC channel between 1969 – 1974 • Officially Python was released on Feb-20-1991. • Python is General Purpose Language and HLPL. (P) Python Development • Python developed based on….. A)basic coding from C-Language. B)Object Oriented Programming features from C++. C)Scripting Language features from Perl and Shell Scripting. D)Most of syntax in python derived from C and ABC-Language Areas we use Python • • • • • • • • Development of WWW(web Applications). Development of Desktop Softwares. Development of RDBMS . Development of Gaming Applications Develoment of Networking Applications Development of Data Analysis Applications Development of Machine Learning. Development of AI…… Sites developed using Python • • • • • • Google Youtube Yahoo NASA Dropbox Reddit(Pure Python). Features of Python • • • • • • • • • • Simple Open Source HLPL Platform Independent Portable Dynamically Typed Procedure and OOPS Interpreted Easy to Integrated More Libraries. Simple • Python was designed to be easy for the beginners to learn and use it effectively. • The syntax is as simple as basic mathematic operations and readability. • Compare to other languages python is having very less keywords . High Level Language • Python is a friendly language bcz it is HLPL. • Python developer no need to think about memory management . Platform Independent • Write once execute anywhere make’s Python platform independent . • PVM will take responsible to convert into Machine understandable code. Portable • It is portable programming language. • Python can be migrated easily from one platform to another platform easily. • “SAME RESULT ON ANY PLATFORM”. Dynamically Typed • Declaration of Datatype is not required for the variables. • Eg:- int a=10; in other languages • a=10; in Python. • Based upon the value Datatype is assigned. PO and OO • Python is both Procedure and Object Oriented Programming Language. Interpreted • No need of compilation ,internally Python Interpreter will take responsibility of compilation. • In case compilation fails Interpreter displays syntax errors. • PVM is responsible to execute Object file(Compiled File). Integration & Embedded • Python supports integrating of other languages into Python. • Python+Java(existing code). • Java+Python(Embedded). • CPython:-used to work with C-Language • Jython or Jpython:-for Java Applications(JVM) • IronPython:-for C#.Net platform Python Tokens • • • • • Identifiers Keywords Datatypes Literals Comments Identifiers • A name in a program is called as identifier it can be variable name,function name,class name ,module name etc.. • Rules… A)can be a combination of letter and digits(a-z & A-Z) B)digits (0-9). C)Special character (_). _ indicates it is private D)it sholud not begin with digit. E)it is case sensity language. Keywords • Keywords are also known as “Reserved words” whose meaning already defiend to the System. • We have 30+ keywords. eg:-while ,if , for, break,return ,import etc.. • All keywords in small case only except True , False and None. Data Types • Represents the type of value we are going to store in a variable. • But in Python no need to specify the type , • Based upon the value the type is assigned. • Python have the following datatypes(built-in). • 1)int 2)float 3)complex 4)bool 5)str 6)bytes 7)bytearray 8)range 9)list 10)tuple 11)set 12)dict 13)None 14)frozenset (P). Numeric • • • • 1)int 2)float 3)bool 4)complex Sequence 1) 2) 3) 4) 5) List Tuple Set String Range List 1)List is collection of entities. 2)Represented as[] eg:lis=[100,101,108,1947,90,90] Set • 1)Set is sequence of elements • 2)represented as {,} • eg:ss={12.12,12.14,12,15} Tuple • Seuquence of elements…. • Represented as tu=(1,2,3,4,) String • • • • 1)String is sequence of characters…. 2)used to represent labels 3)it is represented as “ ‘. 4)char is also represented as String in python. Range • Is used for iteration of elements(numbers….) • Range(1) • List(range(10) same for others… Dictionary • Which stores the elements in the form of key and value pair. represented as {k,v}