Python programming tutorials

all()Checking elements of Iterator
any()Checking elements of Iterator
bin()Converting integer to Binary
bool()Return True or False based on input object
bytes()Returns bytes object
counter()dict subclass for counting hashable objects
dateDate functions
StringString methods and applications
listOrdered changeable items list
tupleOrdered unchangeable items list
setUnordered and unindexed list
functionsUser defined function with Parameters handling
frozensetMaking elements of iterable object to immutable
File handlingMethods for file handling
Sample CodesSample codes in python
strConverting object to string
try catchHandling error in Python
Class & ObjectObject Oriented Programming in Python
iteratoriterator using iter()
id()Getting unique id of the object
for loopfor loop with break continue and else
generatorcreating iterator in python
JsonJson methods to manage Json data formatting
tkinterAdding GUI in Python
lenNumber of elements present in an iterable or string
mapapply function to each element of iterables
maxMaximum value of the iterable or string or series
minManimum value of the iterable or string or series
mathMath functions
mutableMutable and Immutable objects
reversed()Returns a reversed iterator
sumSum of all elements of an iterable
zipiterator object by using different iterables
randomGenerating random integer and float numbers between a range
DjangoPython web framework
inMembership Operators
isIdentity Operators
BitwiseBitwise operators in Python
Database Management using Python
MySQLPython functions to manage MySQL database
Installing Python
IIS cgiPython through IIS CGI
pandasPython data analysis tool


NumPy ArrayScientific computing with Python
Array MethodsMethods to get result ( output ) using NumPy
random.randitRandom integers with lower and upper limits and size
random.randUniform distribution [0,1] of random numbers of given shape & population
random.randnNormal distribution of random numbers of given shape & population
random_sampleContinuous uniform distribution over an interval
BeautifulSoup for screen-scrapingBy using BeautifulSoup we can parse HTML or XML documents and get the required tags or contents
tensorflowtensorflow basics
matplotlibmatplotlib library to draw graphs
BeautifulSoupmatplotlib library to draw graphs

indentation matters

Indent in Python codingBlock of codes are maintained by using same indent. Line of codes within a particular loop or if condition is maintained within the same indent. Nested loops also maintain the similar indenting condition.

printing output with format

name="Ronal Jack"
print("ID :{:02d} Name:{:15s} Mark: {:2d}".format(id,name,mark))
Output is here
ID :05 Name:Ronal Jack      Mark: 45
str1="Welcome "
str2=" to "
str3=" Python "
str4=" Your student id = "

print(" Hi {2} {1} {0} ".format(str1,str2,str3))
print(" Hi {0} {1} ".format(str4,id))
Output is here
Hi  Python   to  Welcome  
 Hi  Your student id =  5 
Correct the first line to get proper sequnce of words

Printing decimal upto 2 places using format

my_str="Mr ABCD"
name="Welcome to Python"

print("Hi {}, Your id = {}, Your Average ={:.2f})".format(my_str,id,avg))
Output is here
Hi Mr ABCD, Your id = 5, Your Average =356.23)
Python adds one line break after each print command, we can remove the line break ( Watch the end='' within the print ())
my_str="Mr ABCD"
name="Welcome to Python"

print("Hi {}, Your id = {} ".format(my_str,id),end='')
print("Your Average ={:.2f})".format(avg))
output is here
Hi Mr ABCD, Your id = 5 Your Average =356.23)

Printing using variables inside string

print("Hello ",b," to ", c )
Output is here
Hello  welcome  to  Python

Using escape char

Test on Basics of Python Let us print I can't travel by bus
print(' I can\'t travel by bus')
We used escape char \ inside the word can't to print single quote instead of using as string termination.
We can use special char \ inside our string without using as escape char by adding r before the quotes
Here \t is not considered as Tab and the out put is here

We can add doble quote inside single quote
print ( 'We said "Welcome to plus2net"')
Output is here
We said "Welcome to plus2net"

Post your comments , suggestion , error , requirements etc here

We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 All rights reserved worldwide Privacy Policy Disclaimer