0% found this document useful (0 votes)
198 views6 pages

Python Modules PDF

This document discusses Python modules. Some key points include: - Modules allow code reuse and organization. Common code can be packaged into modules and imported by other programs. - Built-in modules contain functions for tasks like mathematics, random number generation, and statistics. Popular built-in modules include math, random, and statistics. - User-defined modules allow programmers to create their own modules to organize their code. Modules can contain variables, classes, functions, and more. - Modules are imported using the import statement, and their contents can then be accessed using dot notation. Modules can also be given aliases when imported.

Uploaded by

Shadow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
198 views6 pages

Python Modules PDF

This document discusses Python modules. Some key points include: - Modules allow code reuse and organization. Common code can be packaged into modules and imported by other programs. - Built-in modules contain functions for tasks like mathematics, random number generation, and statistics. Popular built-in modules include math, random, and statistics. - User-defined modules allow programmers to create their own modules to organize their code. Modules can contain variables, classes, functions, and more. - Modules are imported using the import statement, and their contents can then be accessed using dot notation. Modules can also be given aliases when imported.

Uploaded by

Shadow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

PYTHON MODULES

dules oue dtnaly pyfu


tontaung hera
kat
Can be mportea aide nehesI hn
mn drple powms, Can Lensiden a
b e dAme a ude Ubmuy, Ze .
CentrunsA set ofuiens
chudem yeu ahbhiatisa

de oc+lmg/anamt)
pdule.p.
pintHelle +mame

Use a odule
Jowe
tue_a_medele, t nedsh be anposted usag
mpt satement

wnpot Mymldyla
mymcdulle eung ("Jehn")

Hel, John
Vuables vn odule,

The mudnle. Can alkedontam vaniablei oall ypE


elAsSMAte
Date

avuays, dietinanies , cbjeck ete


Psen1 = T
name
nan " Jehn",.
36
age ymtdue py
fowmty 9ndia
EX Impor ymedule

mymedule personil"age"
pamtla)

Re-namin a_ladule =
eWe tanCeate an alias whan he mpcrt a modu,
hea" Leyuserl

impovt mynoalule a mX-


a = mx:p eMAOD 1L "age"1
mt la)
cle.ssMAte
Date
Page

uilt n odules=
hee ae several budl- im
modules m lyth w
Lee cn Anprrt thenghe regpuurd and lte
KeguvyemeuE

npert_frm mdule
NeCan_chrap o mpert Coly paHK ham4 odub
by _(ALngthe "m"eyerd du R,

m nymdule mpeot persn1


prmt Lpi 1/"age "
hen Lmprtung usng the mem keyuLId ,do t
ue he module Vmane shen aerviog t
n he Modeule.
elemens

uilt in Math Functions


The mun) and
max amtttohs_can be_ued t
Ad the lhesE highest value a n ityablt-

he ahs0 Amction zetuons the ab selute+W


vaue &A speeied numbe7.
ASSMAe
Date
Page

The_p ) Aumchin etrhs the valye


teshe pewez e/ y_la)
The Dathodule
fytho bas also a buitt-h modu/e_called
an4t_ah1th exteds He isE mathemah-
Cal untdioDs
lanpt math

math: Sqrtl) - rehans Square ODt

math Ceil) -Tunds_anunbe _tpuaud s


is neansE lntegeT.

math lecs()- Tounds a number_deunwouds to


is neaed imteger
math pi-ik a ttnitant m torhs he valu e_o
PL

(5math fahsl)- Teturns he ahseue value o


anunhera

mohSun ()-ekrzhs thesint ef a number


Date
Page

he cosine &f a
th Cosl=rersns
umbey
L nun
math: tanl)- retrns he target

nalh e 9k a contlant Mhizni Eules'sles's mune


l7182)

The Randem odule- 6

ythen hasabuit-n_ mdule hal you tan we


make Andhm mumbes_

2dem) - aetns a oandern lea umbe


bekoeen 0 and 1

Tandarge l)- Keheins 0 r an dem vumbex. ber


ekwuh
behoeen he gven TONg e
andiot)= etuans a randen num be
betwee0 the iuen yanGe.

The Statsties Module


Bython ha a_bult-n mecule_uuhich can be mpc
ted tr ue stahstical
funeten
mean etuuns he mean_ a the_queh -
ASSMAte
Date
Page

umbeH

emedianl)=sutunms the median _/ he Jtiun


_Ae veluel
(3medet) - kebuuns the
onodol thu-geun dot
E
Vaues

You might also like