Using Python Libraries
Using Python Libraries
Using Python Libraries
Python Libraries
Library is a collection of modules (and package) that contains a specific
type of applications or requirement. A library can have multiple module in
it. Some commonly used python libraries
3 SciPy Library:- This is another useful library that offers algorithm and
mathematics tools for scientific calculation.
4 tkinter library:- This library provides traditional Python user interface
toolkit and help you to create user-friendly GUI interface for different types
of application.
5 matplotlib library:- This library offers many functions and tools to
produce quality output in variety of format such as plots, charts ,graphics.
print(pi)
print(sqrt(16)) print(FREEZING_F)
print(pow(5,2)) print(FREEZING_C)
print(ceil(2.9)) print(to_centigrade(100))
print(floor(2.9)) print(to_fohrenheit(100))
Using Python Standard Library Functions and Modules :- The Python
interpreter has a number of functions built in to it that are always available
you need not import any modules for them. The built in function are part of
current namespace of Python interpreter.
num=17 tnum=5.555682
rnum1=round(tnum)
onum=oct(num)
rnum2=round(tnum,3)
hnum=hex(num) print(rnum1)
print(“Octal number conversion ”,onum) print(rnum2)
print(“Hexadecimal conversion ”,hnum)
o/p Octal number conversion O013 o/p 5.555682
5.556
Hexadecimal conversion Ox11
‘*’.join(‘Hello’) op H*e*l*l*o
‘****’.join(‘TRIAL’) op T****R****I****A****L
‘$$’.join(‘Trial’,’Hello’) op Trial$$Hello
‘####’.join (‘Trial’,’Hello’,’New’) op Trial####Hello####New
‘I Love Python’.split() op I, Love, Python
‘I Love Python’.split(‘ ‘) op I, Love, Python
‘I Love Python’.split(‘o’) op I L, ve Pyth, n
‘I Love Python’.replace(‘Python’,’Programming’) op I Love Programming
Using Random Module
import random
print(15 + random.random() * 5 )
import random
import math
print( math.ceil( random.random() )) What will be possible output