This document provides an overview of the Python programming language. It discusses that Python first appeared in 1991 and is designed by Guido Van Rossum. It highlights that Python is an interpreted, high-level and dynamic programming language with extensive libraries and support for object-oriented, functional and procedural styles. The document also gives examples of basic Python commands, variables, operators, control structures like conditionals and loops, functions, modules, and data structures like lists, tuples and dictionaries.
2. ABOUT PYTHON
– First appearance at 20th Feb 1991.
– Developer: Python Software Foundation.
– Designed By: Guido Van Rossum.
– Stable Release: 2.7.14- Dec 17
3.6.4 – Dec 17
– File Extensions: .py, .pyc, .pyd, .pyo, .pyw, .pyz
– Popular IDE’s: pycharm, pydev, wing IDE, komodo IDX, Eric IDE
3. SPECIALITIES OF PYTHON
– High level programming language.
– Interpreted language.
– Dynamic type system .
– Automatic memory management.
– Object oriented programming.
– Functional and procedural programming.
– Large and comprehensive standard library.
4. BASIC COMMANDS
– Printing output: print(), print(‘welcome’), print(“welcome”)
– Getting input: input(),input(‘enter the value’)
int(input(‘getting integer number’), float(input(‘getting floating number’)
eval(input(‘getting input at any data type’), raw_input(‘getting input as string’)
5. VARIABLES
– name=‘star’ Assigning a string content to a variable
– rollno=1 Assigning a integer value to a variable
– Avg=92.39 Assigning a float value to a variable
– Dynamic memory allocation is followed here.
– We can remove the variable by “del” command
– del name
– Termination symbol “;” is not needed for every command but the Indentation
is important.
7. CONTROL STRUCTURES
– Conditional Branching if, if…else, elif s-start
– Looping Statements while and for statements e-end
st-step
if (): while(-----): for( I in range(s-,e-,st-)):
executable statement executable executable
elif(): statements statements
executable statement
else:
default statement
8. FUNCTIONS/MODULES
– Two types of functions are here, they are
standard library functions
User defined functions
– Standard library functions like math, random, time and etc…
– Three ways to import the library functions:
– import math
– import math as m
– from math import *
9. USER DEFINED FUNCTION
def function_name():
attributes required;
#Function_call using the function name
Function_name() function call
# (command line)
10. LIST
– Collection of certain values
– A=10 variable assignment
– A=[10,20,30] list(ie, like array )
– List will support all data type in a single storage variable for example,
B=[10,10.90,’start’]
– Dynamic addition, indexing, slicing are possible
11. TUPLE
– A=(1,2,3,4)
– The circular braces is used for tuple, and for list square braces is used.
– With this tuple we can retrieve the tuple and we can do indexing and slicing but
cannot do any modification into it.
– This is one of the specialities in python.
12. DICTIONARY
– Week={1:’sun’, 2:’mon’, 3:’tue’, 4:’wed’, 5:’thu’, 6:’fri’, 7:’sat’}
– The dictionary storage has two attribute in a element, that is first one is key
value : corresponding value.
– Retriving , deleting ,copying and updating elements can be done with this
storage.