Class 12th Complete Notes
Class 12th Complete Notes
Patson Modules
A module. Ruthon a fle.
Containn Pt CodeCKmch on, claseA,
that Can be euJed
otherr
qm
Modle
imoat statememt
im pont Cmodule. -name
Cmodule
<module-name,<hnction>) # yjng module
fnchon
tsnm tahememt
Also
fnc 2(
But it not eCemmended,
pre-dehned Vsesdened
len)
(Cai Jantak( o)
pant ('Hetto")
Name of
the Rnchon -Ayment
Rnchroni
Jet Bom as): del Som (at):
etum atb phnt (at b)
Thi
the value but This omy pnts
docont pont. Value
retum
but does n't
mum= Jum
mum= Jum (1,5)J
wil) have num will have
the etned valve 'None'
but we con do But this nctn Call
will
pint the yetu nedvale
Calling a kmchan
Jheet();
|pmat ("tello)
pnnC kaise he?)
Calaggret ()
Pamameles V/s Argmtot
def Jom (a, b):
pnnt (atb)
Sum Cyd)
’The va loe ct c goes to Onders
Mattes
* Delauit igmati :
Defaslt
must be
ayguent
det Sum Co, b,e=2): Side
prnt (atbt)
OUTPUT:
I3
pmt (d, e, ?)
pmnt (3, e)
4ccessble
at ’hobal
ypes Twleopes
) leve local
l Local
at) onlg ccesible a
Out to
Beope
Sespe.
not cause ßec eor, hireo ’
(name) pnat
Hello
jneet
()
Nl') phiat(noimye telo, Hello' Soytello
Ragat'
gneet(): mame
Vamasles ot
detSape
*
ogmenb keywe
Can we
2.
eall fmchon
parmetrn tme the at
pnt(atbtc)
(ayb,c): pnat
onmygment Keyone det Sum *
(Named) onmyment
Houw
Vamable 9
L’¬’6’B Rule
pnt (name )
puti:
(utput Hello Ranat
Rgnatt
fle
e han a
bony to ef opeuton
lhue cocohnË, reading
delehng Re unhng, apendj
enables
P s s to nteact with kles
Stoned on the
persistent data Jtonage and setr
ieval.
Alasslote Path V Relatye Pata
Awoloe Pat : The ath gen tom Toot
E: le
eMist but
gead mode ’ Cr opened
Warte node ’ Creates CFle Not foumEor)
tat Rle
append mode ’ Creates that fle.
Ahere Some mse wmodes !
attach the table.
Text File Binary File
Mode Mode Description Notes
'r' 'rb' read only 3 Default mode ; File must exist already, otherwise Python
raises I/Oerror.
'w' 'wb' write only If the file does not exist, file is created.
* If the file exists, Python will truncate existing data and
over-write in the file. So this mode must be used with caution.
'a' 'ab' append File is in write only mode.
If the file exists, the data in the file is retained and new data
being written will be appended to the end.
$ If the file does not exist, Python will create a new file.
'r+' 'rtb' or read and write File must exist otherwise error is raised.
'rb+'
$ Both reading and writing operations can take place.
'w+' 'w+b' or write and read File is created if does not exist.
'wb+'
If file exists, file is truncated (past data is lost).
* Both reading and writing operations can take place.
'a+' 'atb' or write and read File is created if does not exist.
'ab+'
If file exists, file's existing data is retained ; new data is
appended.
Both reading and writing operations can take place.
Cloxng fles aftey opeahon
(To bcak he link bl fle handle ond Gle
Opem ("kletHandlngtt')
#perfmmopeabons
hle-close ()
# Reading from tet
ophona Ales (ta+)
(itut (n charackon)
"seadln) : Reads n'
2 emire line
"Nead line(n) : Redy n? Qses by tes fom
3) emh line not spefed
neadines: Read all lme
element
amd
of
etn
"eadlines C
ato mghle: reud lmes()
mhle-lwnte (wte tis tone 3)
binangidat" w)
Oats Binang ftes also called pisklig
prcxle dmp(content to be wnie , <Bte Hamdle)
Cx: pckle dumyp ("Hello ", ghte ) dmp is also
4ppend
mode
impont Chv
Gample:
CsV-nte wnte Tow(c'2', 'Aqosh', qo'3,
C°3', 'Aat', 803,
C'4,eel?, 3s '3,
C's', 'Jobh ny',$6'3
Rexdng m csv fley
Inprt CTcate Teades
object
-impont ciu
mhle open ('
yhieentcv',newline'l)
CsVtaden - chu.yeaden (mhle)
all he lines:
Csv_tadeg:
pont Ci)
2) Readmg all the
elememt Iines
CJv Yeader:
pnnt (i)
pontj)
b=0
pnnt ( a/u)
encept:
oemt wmg")
Data Stvhses (Stack)
(ts pet
l202S
Data tctne:A Jata Jhcte
of ogzi toning omd mana
eRkheremtly
efferenth to penfosm
acces, Tnsenhom, and
openateons
deletor
Data Stvcure Ctypes)
Linean Datu Shvctes 2) Non- Lin ear Data sh.
Here, data
Here, datu is
hieraschically
Sepen tray Complen tlahohyps
GL: Irees
Linked List
Stackyi
Qoeves
Tn allabus
V/s Qoeueg Tmyprntat
Bot lnear dat shucturea, but
Stack olow LIFO - Last In fiat Out phaciple
ie, element in Jented at ast Cwill be
deleted fint. ( Like Os des of Books kept
One above o thes)
Stuck
Step-0) we have em
Stack
step-1) Lseot elements CNmbes) ne me
top
6
And Delehion caen only happem to the
top elememt
C: we hae:
top
3
#Teminales fon
to Stack:
elememt.
i) PusH Opeaton: Tnseathon
: De lethon n element (top)
if Jen(st) ==0:
top = 0
Q. WAP to implement Stack using List in Python
def isEmpty(stack):
if(len(stack)==0):
return True
else:
return False
def push(stack,e,top):
stack.append(e)
top+=1
print(e,"is pushed!")
def pop(stack,top):
if(isEmpty(stack)):
Tough lag raha ho
print("Underflow!")
else: to video dekh lo
top-=1
item = stack.pop()
print(item,"is popped!")
Click here
def peek(stack,top):
if(isEmpty(stack)):
print("Underflow!")
else:
print(stack[top],"is at top!")
def display(stack):
print("Stack :",stack)
stack = []
top = -1
while(True):
print('''1.Push
2.Pop
3.Peek
4.Display
5.Exit''')
choice = int(input("Enter choice : "))
if(choice == 1):
e = int(input("Enter element to push : "))
push(stack,e,top)
elif(choice == 2):
pop(stack,top)
elif(choice == 3):
peek(stack,top)
elif(choice == 4):
display(stack)
elif(choice == 5):
break
else:
print("Invalid Choice!")
Date
Page |
Computen Nehaonks
valhtem afmehonkimgA
*Cmpues hehnk Cemputen netOn k
S a collectm intesconnected dévices
Hhat emmmieate Qhane
CommumItatiom beee.
Fuolytrn Netosking
1: ARPANET FomdatioM Mode n
’Man punpose
decemtsalized Communtcatie
CoEate
’ BaseA Tcelie
olobalComvn micatcm
pnotool, allong
’1ntroductn to helem metonkS
len ophes fon
hiah peed
Coynnnicatenbunes
Vn 0ne,
educaticn, makng
ntencen nec ted. 0
the
Date
Page |
Commmeaten
OdeviceA
medim
device mitrates
Semds the.
par cable,
Coanral cablea,
frbeers Ophe Cables.
()Winelesa : Radro Laues
Mcwaves
Tufeared
Jatell:te Commmicaten
Date |
Page |
Popalan otocols
Contol Rotoa)
Used on
fsatocol: Used
tramafes fiea
alesnng
email
Prrotocol
Cummmicatom
om municabem Media
Bamddta
’lhe, maImm data tsafes ate
of medim.
’ MeadyNed pen
’Hrahesn bandLwrdth tutes data transfes.
Date
Page |
() DataTateo Rate
he achval speed at which data
tnammtted
’ ARecteb mehaon Congeshon, mlerslexence,,
nd hare Limtatens
local
wrthin CA
Page |
are method
dat metwonks.
Asanfen
’A edicated OcommuMcatom path
establesaed befone. data tsonmillrom
thonal
Gxampe metnki
Aelegphohe.
’ Poo: Reliable minimal date
’Date
Date is benmto Small pachet
each Sounce deshnion
meed on C dedcated
path.
Com Enpeemce. due to
Date
Page |
the
Lneles channel Aon data
tsmafe behscem device metonh
Catgonea tytJireteas
Cm municaticon Medaa
liosted Pain Cable i
’_Shtei Conmdist1 inulated
Coppen wines toisted togethes o
Tcduce electomagneh. intefesence
Tapea: UTe (Uhc lde d Tuscstod Paz):
Ethenet LANS.
dted
Ais called, lbeter Jhic lding
Doad vaatae to tued
hasdes
pas
to
Cables
natal)
Comparsed
)eOgt Cable
pulsea to tonmt
plaahe irea
Page |
to Insall
Dundvantases'
Om
Cupense,
mantan.
areal, uppont
mobli
secunita thrcat
) fraed Waves
1) ModemModalaton - Demodulat)
’Convebe tom Com pules
nto nalog
me Lnea
tsanmisiom
telepe
heme metonk) to he inem
Page |
Deauts
3) RISCamecto n
to COnnect Etemet
CablenU to nehwonk device
4)| Repeates
|’ Amplifes and Egemeat metn
eantemd Ahe tsa misorm
netwonh whee
ove long distamces
Dato |
Pago |
SHuß
device 4hat
Connets Vnulti ple C,omputer
LAN brodadcoUst data
ho all Connecte devicea
netuwonks but
langely eplated Juitehea
A netonk
direct data
devce
to
that ntelliem
the Spe cifc
device meamt fon,
neooni
Atvamtay Reduea date colluios by
Sendng date cony to the
intcnded
Commaicatiom
Cimultameous
).
nh data Centel,
ce
LANsetvps
into
metoonha Wi-fi
toConnect to
emeables that acapteI
JeviceA
ica Vo?
onk). Bluetooth with
Cennech
ng potocol
9Catey metonk
different hajeen beLidy
acceA nemet fos
Bumes
Ccmnecbviy
wi Prourdes Routs ’releM
Cablea Ethesnet Usea Rostes wined
based pachetse data
eA
dsect Tutemet) the to
home nehoonk moltple Cmmecds ’
Page
|
Date
Date |
Page |
waf Adapler
device wcleM
fe
Erasplesi BluctoctBl Cenechona
wisele headol1emastatehes
Cuample in
buineN:
3(the met Com neded Com pute
ofheen:
intecta
ultplc devicea
CmAN)
nehwonky
folle Lwri hot spot in Cihes
CoveI a larsg
CCmnetn mulhple
Vahes
aploges
Newos o the nngeneat
of deite, mctwnk
Date |
Paga
e) Bus
’All devices mected to a
cental Cable
Set u
em Cable
cevices Connect
central swrteh
to et
le cable.
Hob
g Jts Comqartd
to Sehup ’Comple
afiected metuonk
enhrt the fels, backbene the
tanesDisadan ’
metwonks Scalable ’
izaion hesarchical,
organ Sopponti
Advomtaaea, ’
cne. backb
Comneckd
to nehonk
binahon Cem
lopalog ()Tre
Page
|
|Date
veA: mail to cliem teom emalmal eJemds ’
CimT otocol Tromsfeo Mal4)Somple
MetwoNh
Oves
ptees Com between ’Tsonfea
leA
(eTP) Psotocol Tsfes fle
3
Jecune.
TTRS) Jecure Rrotosal Trasfes Hypente 2)
intemet the we’Tncsfe
b
(HTIR)
eikucatly andaccunately Oyeceived
and tsasmted data CnJune
(hey
metunh
devicea loetweem
ules define. pnotocols Netuosk
notocol. Nehwonk
Page
|
Date
Date |
Page |
mail lesve
to C client
to anothes Commputer
Page |
Webutes
collecton o
deman
A Jesysce that
to Lwebitea the
ntemet.
PAGE
Oatabase Management
#Relahonal DatabAheA
&odvben to Relatenal DatabaseA
)A relati enal datahae Jtones
tables (relati)th and
colmn
Oatabae
thatnteract
oith 01e55, applicattmA, and databahe
to tone auad etoeve data
Cene'et
’ Data Oagauizatm Sto.nes data
mamnen.
Cmalei
ta
ble anotheo
fos sdembfe
data TepseAem
hag
table a eld AClolmn ’Aitole
table
rcond Snale CRowi ’uple
columns data
laked callechon
t (Talie:A Relatin ’
tablesCrelabema) into
Jata relatiena The
Codd Ef Dausloped
b
Model base Data
pplcatms
Sepanta
data Sepaatea depeadenee Data
avmm
mulple Allaw Jat acleM
to
Sbamng ’Data
tmaullhanize Reatac Serunty
i Data
PAGE
DATE
Database
databae based
Stsuctused
featunesi
’ fast and calable
Secune Cm plianle,
’ Cem patible Loith mina
Cstoycttd
databaeA
: database uatem that
E
Relatenal (odeli
4 Relaton (table)
Colmas
-> Cach iclaton
in the. dataase
2 tbute, Column)
An attabute.
clation Ctable)
Cranagle. table
attaibutea.
3Tuple CRau
’ A tugle.
rtpreaeat
table
Canmple ule
attiy e
bave
DATE_
PAGE
5The
MumbeS
dearee gelatcm
atta butea Ceolun)
Ahe
table
6Candnaly
Casdinalihe reless to the nmben
Eromsple the
Hhen
Shiden
demt table has
Casdnality0
Relatcma Mode
Camdiate Ahat
idenhk
Shud emdO email
DATE
PAGE
StudentTable:
Student IO Name
l01 CIE 101
10 22 CCE 102
CowneA Table.
Covnsc_In CpK) Counse Nume
CSei01 Compute Sereme
EcE10L Clectsm
nsunge Manipulatn
Lanqunap Defniten (Data DDL
1nt divced
yaanta Ceahant Gafoncedat
élhcuentl data RekneuE ’
geconda delee' update nsen
tablen anddatabaes Cscate ’
datalbaAeA elatishal
lanaaoQ
C
Cstustned
telble
CouneA reescnang key, foneroh
the
table emt thwd the Counye
table Counsea the
Hhe
table Shodemt
he
FAGE
DATE
tudent DESCRI.RE
hovcte: table,
Uniae
INT,
NOLL, VARCHARs0)
NOT Noace
KfY,PRIMAKI StudemtID
TNT
shdemt table Cneate
tablei Cseate
a
databaeAj shok
databanen! all Show
databasei
School; base data Caeate.
seate
esCRIRE SHOL)
DefuhmLaga UJE DROP CAEATE,
ADatoa
PAGE
DATE.
DATE
PAGE
Alteo a ta ble
Colm'
ALTER TORLE _shdents Aoo COLUMN
Adse VARcHAR C2ssi
" Remot a Colwmni
ALTER TABLE tudents RopcoLUmN
Addsdi
Daop Database
op
DROP DATA SASE Sebooki
DATE
PAGE
aipulaton.
eRE INSERT SELECT, VRDATE DELETE
Laent data
ceta nto table
aseRT TTO Sthdenti Cshudents In ,Nat.,.
Asp., Cmaik) VALWEJ CloL,Rai' 2,
raCamat.<cam')i
"Retiee all
SELECT fROM
" Retnese Speckc Calmmd
SELECT Name, A fROM hodent
"Update Data
UeOATE shodemts =22 wHERE
StudentIn =I01;
Deleke
OELE TE fROM shdemts wHCAE ShudeatIn o
DATE
PAGE
Data in
*Cosant
NOT NULL >Emne a colmn Cannotla
have NULL value
valuea Colmn
’ Mathematical Openatsns
Addston
Jubtsachon
Molbplicahen
’ Relatenal Openatond
Eaual to
Not Capal to
Cucaters Hham
Lem tlacm
Chreaters than
Len tham eapal to
at least
Cenditon
NOT the Cendrhen:
PAG
mame
Alasreng tcmpon
ta ble colemn
"NDLL me
meaMA the value mknOwn
milina
SELECT Studemt LUHER mai
NULL
fROM Shudeni wHERE Email
NOT NULL;
:LIKE curth
lause CPatenn matbhina)
amben o chanacean
Characles )
stastna witt R
chasactes
stas with
mothing
Contan A, a hasatesy
H.
Cam end w th
aythg
fmchens
MAx< ’ RetyDm the mam valve
MIN()
SUmo
CoUNTO Rethn he
3ELECT cOUNOT (+) fROM studemto i
SELECT () ShudemtJ;
omd HAVTNG Clause
Condits
Colmns
NATURAL ToLN ’ Aotmahcally ions tables
based Cormn Colym
Casteam
Castaran prodct Lwhem
each fisst table
Cembined 4he
Secomd table
table A has
has the Lave
X m
Talte
2
3
Svdent table.
Studend10 Name
Ray
" Coun ses table
CouneIS Coune Name
.101
402
Tnes Jon
thal wmatcheA gcconds ing
Colmn
Shdent table
JtudemtID Counse_IO
Name
Ra 401
2 102
Nane CounyeName
Ro
CATE,
FAGE
"Nabaal Jom
’ANehnal Toin autom atecally oin
table based
eat the
Colmn:
Cxamale
SELECT Name, Counc Name
fROmshodenti Nathonal T0IN Cou.nsesi
Name Coune_Nane
Rai
ame ?
mn
JTUDENTI JOIN
Counves ON
all colnm
clas mate.
Date
Page
with datasase
ttalline Packa
initall
pip 1tall
Ceonnect
directle to database
@Conmechng
1mpont m :connectn
hot localaolt
at paswd toen' databae 'teat1?")
classmate
Date
Page
Jampde
CCneate táble
Mame VARCHARCo),
Jample tav colon VARCHAR Co
)! )
Asnt (( Table ceated)
pant
Indent i'nto Secon
fav-colon) valires(1 Davsta
Jeit, Iusq,uaiie (2Lelia Uiq ran'Biu)
(3,Susaan Ponsfondcnmda " )
I/ Lmpontamt to commt
pit CData Cnses ted)
Sample 3
IO:"))
pot CEnter
nput (Gatex
: ")
Colon:")
goun fauOUnte
Cunso) Cnecute isent int
favcolon valves 7S, 7 , Y-s)Cid, name,colo D
Re taeeo upto
etehadl
Retaevea all rtmainnag Ycerea
0weOunt
Retvom nnbes ct Ow) afPected last