python Manual
python Manual
• • Python fntu,-ucu,·ehell prompt conl.ftma opening m".,.11¥" >>>, cnlloo hell prompt A cul"llOr
"' w,ntln1t fur the ct1mn\llnd A complel.c commond is culled " alatcment \\'h.,n you wntea
commnnd nnd prou ant('r. the Python mtorp1·ewr will 1mmudiately displRy the roault
f " ,.,.. "j.,,1--'t>•!I □ )(
,... JQ.•1 ,....,. o... tip 0,;tl•,•a w....u.- H,lp
r non >."'1.1 c.-.,i.,• .1, .0•4:" -C->••· 21> ;!OJ.■• 14tQ••-'•l !KS(; .... 1•1• ll2 b.&,1, Clr.-.:•
11 1 en v.1.ft.J.1 •
T")'l,:"' .. ,,,...,P .. .. ._py&!'i.'-lht.•, . . e. r•d1.t.•" Dt f"-11.r ...,._.. (J .. t'ft.................... 1.l"lt''Qt"-L..L .
::->> p;s-.1.ri,:: r • " - '
1-t<!'") 'lD I t:.n-,n
►>
1
(XI} laetCf.N
an . eo,n u e. ,
1:11 lwpo:tww.
It hUpt,...._•
.u. •pe,,a, '• "MW"- "'••ta.di mo,.- lllll" a!
.II J•nnl IJ•• nf"Nllft-4 J)'thiin
,.
":1
1.1,i,o_
t,u,pr.Nww•,=!b!....-........a
..2) \l'ri(• SO.. 11,w,,d 14IOad S')t111f<li ttilll',,...lninwiMu'fl't (X:UI) A.......un t
(!e:!lotAnt.,..,J
Gt--,. 7mr({t1 q
/Hint.C.SLJS uerswn)
off: ar·JO I CiaqS/v3 I0·/·2alJC80 OfCC ,021, 19: lo:3J)
nsc v.1929 t;, bd c11110 64Jl •
@. ,
stP.Pi
ortn sqstem rrorc1\\e0 Utt ol f-lU44tftt.t lum Naaa&Mn
8/Johtnfl HtrrshtJd
sLer, ,11
cl,ch,ro.n
Siuebcn·,
actuancfd s4sJ emf,llinq. in chandquder10
lht M.f • tc I
2, OperaLing System
3 Devrlopment Software I
(X) Practical related Questions
Note : Below givrn are few Btvnpleq11estion11for reference. Teachen, -nmst de1ign more such
questron11to emmre thl' achiecemn1tofidentif'ied CO.
(1) List duforentmodes of ProgTnm.nung ,n Python
(2) Describe procedure to w,:eeute program using lnternctive Mode
(3J State the steps mvolved. in executing the program usingScript
Mod, l•ll Stat;, th proc:edw·e to make me oxerutabh•
[Space for Answer)
r.1omr1 Miu:.. ,. Ond fits£ enle, answer will
.b e d
(j)- ,.. 9ofo f,1 e -;- c:reote n·ew.r,le torlle 4 ourC
etecute. c.ode us,nq f6 .D1..Run bLJ.tton.
&- add a shebOoq /inf fidliL smrt. #- ! Jun Jli
Jh • env P.LJ!hon _ . . ·
rnarh ute scr,pf f tcuJobte chmoil .ix. .Su1r.1I.
nEan Jhe t1i1 containing to 4our r.llin uor
- Jf>[Y'rt I'fl1H - I fLJfh /lo/ script·SPATH . .
.\"utr:Faculty
(Use bl • - ' - rnu-,'1uur.-
, tieat
.. . .. . .. spa.: ., u>r &nswt'
rrrr: -, lf 1 'oup of •tudrnt• u•r diff.,rent inputt·a/ut>
m o r e
l \\ n tt> a P,,-ihon p,..,,._ .
orattAdi pages if ne fod> .
2 • • ·-e•"m tod up,..y
, your llBIDt' u-111.r lnte tl\eMod
< > \\ nr,a, P,,-ihon Pl"Ogram to d1<1>l.u· ·\t-'8""-'• "'· e
• • • .., r• , usmg.,,, nptMode
-1
, a raJ.se
ex
rl nr
C • 0. &b..·II ,a o.nd b)
b •• ·cru e .
r ,),.1n c • £l ar b.. " • ll, 01 b1
• '°"' ..._ ...-.
,t• forIT r,U,-. •
Pr•c11c.tl related Question. T,«/un .,,,,, dr,/,n- ,.,,
'"T'f'ift1Cd in th{; rir,D,. answer c 1, Wn,.• pn,crr•m to""'"" U.S. dollan to lnd1&n rul)Qd
Ill Wni.•. prqrram tocoavert bita w Mrgab)-tft, Gipbyln IIDd TerabJU,o
31 Wnte• •m to find th• aquar,, root r • numb,,r
rxronenr. 1t1Js arerator rc1f1J1rns the
1
; Wnte a p,oirnm to find the.,.. ofRactan;le
txronenlfol ca1cu1ai1on.
'I
5., Wnu, a p,ccram to calculate •- and p«n...,t.<-r of 1M oquan
@- Ttrn0111 ofe'J'Ofm- . is also hnown a,,. tondiliO'llll 01r: roter a, (l umb.er= li.
orel,ialt&J.oT,f. lllJs saJtement
l}j[nj i CVOIUDICS the t ss,on J ? rt1ue value) :(raisev.
lXPIessions Ex alue)
s4nlnx : Ml'>afao,,c,. SIIIIObrd Ill Teclnca, E 11on
scium, oJ· Lt Ls 2 a
(9-► lfilQth· Hli flnfU/ ("fOltr IPflQlh '))
eo.c\
bttMih: in c·inru. (• fO.lff brfodln) •))
/Hi11t c ,. A1P.O. .., c... 1enqt,, ., hrrodth'J
- -- -
IMt>ara-.. Sllle Boeftl<II T_,,,_-
r
··_)) .
c LJ t s))
oIP·
. ..
.. . . . .. .
-
4
6. Tinwh·SubmiAllion of rt'POrt
6. Ans sample questt 10%
10
Total 150 Marks)
List of Students Team Members I00';;-
.....
(21 ..., .... , .. ..... .
- - -
.
•................,. ••.••t••.••.
Mark,
-
obtained
............
·•·
Process Related
l:JIU ----
Product R el at Datect Sip of Teacher
Tota) (ISO)
ed----
(16)
--
•
- --....-..,..
- ---= -:,--
--
Maharash111S!ato Boardol:-:-:T oeh--:-:nl-ca..,.l""E_duca_"ii, on -----------------------
--
(IX)
.!!.r· No.
Resources used (Additional)
--- --
Namf!or Re.-.ourc.- I Speciticntlon Quanlity RNnarlu II( l
nny l
I Compu r Syatc!m _._
-
I
:.!
3
Opllr • II SyatPm
D<'vl'lopm nt Solh, -------- I
(X) Practical Related Questions
'Yotr Brww lfl••rn an frw aamplP q11r,tlon• for N!{i>rrnct', 1't-ae>ht'N m,ut d1'11/p morf! •uch
q11••lion• to emure thr tuhu-1·<'ment ofichnti(frd CO.
\ 1) List operntors used ,n if cond1tionol statomf.'nt
(2) IJ11Terentiate bt,iw t'n 1f-e)M1llnd nc,too .if ,istt-ment
(Space for Anawer]
.- =
c-.
<: :>
- ..-
, -:
-
:=,,
-- ,..::, g--- , . _
::: ,
e..'
- ,s
-
- .:,
--- .- :::
- - C :i ·-
;
... . . .,
- < .
_.
c ,
:::z.-, =:,
.
::::, i
r..t. _
... - '"'=>
- ,._
S.:::, ·-
c:-
.,
:--,
,-, V> "'b
r--:2_
:3.:::
-
"'-:, .--..0
...... '::,'""'\. .;,
e
'"':--..J:::-;-,3 •• C
-
'-C:: 2
::::> c,-r- <:T.c= -:z.
=3
::,
=
• ::-i
<a
-
l:S0 r•3 c:: ---
- < :: > .•r•::>-c-
&::".'.r..)..
r,-.. ;:?. .::- -..
:;g csls
r--.-.... ,C '" >
-=
c:::,--
c ::,
c=-:, ;:::=
n:,
-, c::r
re:,
:'-"
_r ,r.,... .--,. .. en,-
i = , - .....
-=, ,._ ,.
::::,
~•..::,,_:,
- ::z-
>-,
Cb pt":To:::,:
-,. -,
.-.
..c
'
-,:, -., I 0
-
-'
'
'
"" :3
-
--..i:;::
-<.
l""C> <'" ,,., -,
?f
- -I
POo ""2
I..-- .....,
..c: _o ..
,..,. -. t..: = !:')
<:"
r-,.
-
:::> c-::,
ca..
-,
-.;;
c:::.
.3
'
!:i -I ;:::;.
-
ci:..:,
b
r-.,
,, .. G
g c:r
...,
I...> i;:::, 0
0
--- . .. . ,,
I ' " ! ' ;,
::-, .
.. ., 8'-...,
, .. . . , ,
Y.>
..
u:,
,
. 00
,..:;, ,.-,c,:.::,,-
:::::,
=
-
i
c,:, I -- .,. C'>
I
c-P;:, D :::,
-c !
1 --,
a............................................... ,-g
r-
-c
e?:>c::> i 8..c::i,
-On,-::,o
-
..
&
t"I".> i '"t:>
ggl
I ::1 oc.
C
11
t.:i
::::,
- pC) Prattltal Related
(25)
Quutlon•
,\1>/r llrlnu lfir rn ,.,.. {11• t. , . , . , , , 1 , . 1111r•//•m• {,,, ,,.f,11••n<'•'• ,,..,,,,.,,,.,• 1111111I t1t·•l11n m1>r" ,.11,..,,
' ll
I
h11.n th f II •Ing l'vth ,n ro,I" Cmm ualnR II whiln l0<1p to for l,x,p
10
.9
9.
t
G
f Cl X JO ,onoe c J •.ro.) :
p.nr1t C. ) .
X - X tl
Pto<J,amffld!IJWith Pl'ttion12261&I
[Space for Arawer)
J•rrfol"'ffl•nr lntllraloN_
Pnw- nlacNf· cU .Mark•J
I
l
i
_
l:91!!f '!!:!!,'U '"'"
l n,Ahilil1 _
t"ollow .uu..-.1 <1 _
•
.. _,,,
6 _
Produtt ttl••ed UI Mark••
E t,doutput
Tuilt lz Subnu n- ( "'Ill -
A •r m.e_ quffl•on
_ _::
U•t ot
1
Studenb Te•m Me.mbera --
T oc..1O k) ,1_..-...s,
- -
, Bhnhrne HmsnodB (21 hDIPC runorn Cr
, chondgud e Prosod JDLuale R h1 f\
- Rel•t...t- lCark... nbta.enod
-Pruc-..o
R•1alcd rrod11t.·l Total CIIOI
(36)
1161
(31)
ExA.tnp1 :
>>> h•I 110,20,30,◄0,!iOJ
>>> d•I li1tl21
>>> lt•t
110, :ion, .!iOl
,HU Rc:•mov Op("'r-a.t.c, : \V u.. l-h• ,...mo"e opt,rtuor 1f we know th1.• it4ffl'I that we want to
or d.eh:·tn (C'J'l1n r.h Ua\ (but not Utt> tnd.oJd
laa,nplc, :
>>• 1.. t ll0,211,30, ID,601
>>> liaL.l'IJmovtM.30)
>>> ltrl
[JO, 20. 40, 60)
) R es ou rces Req u ire d
· - - = . . . -i: ...
, ······
(l f
...,.....
-or
O
o,
..
.2.
J
---I-
•
0
tun,
wm
C<!m uter ti3-i6 N!fe.-..-1>-le-RAJ\---l->2_0_B_)-I--.A,;-P"'-,B-=-.,- -h.j-,,F
rulowafL01ux Si-&
--::: ;-
...!'!r=
J
Expt-rimll!'lnta
I
7_ .l...eumssr
(Spo,ce for Anawet)
0 is u ?e d . to - I 0 1 e O_J) 01 dered
. .wh 1 c n m ,q h J col1_eruon of
_be_ J.11ff1eof _. _.
.
To..rP .tn~Dc_i;-_:--u.s.e.d- +Jft. o.frencJfo .e,erffenls- i 01,rit
2 1nsrr1 f) :- _.,ns_erts. an e1fmen1 -rH- Sflff.1fied Iosiiion
_j FJ/, 1
_)COICO) d . St r u& f: 1 r frrao
1
f %1tfOibGreIBern°
srec'1ne
Si
• .<ohalnh1ros1a108oardofTott\nlcaJEdu<:8t'°" -lh& 11st
t;1 - .
0
. ....
\Pl) 1'
3-. .. -...
CJ')-
--
c::;;.
=-..,
I
I
" _::::,._
Q.:::_t)
-c:=_, . -:r-._ ..
--- -'"'"'
'- '>
0
"' <:,..l ::2. ,-...
c-, ..z::: C
1i
..-
-0
,..._t::: .... . I?_
... ..
--c-:. . - ... -?
no-,
- .......
- ...
r:::,,
..
..... ..... r:,.-..
_, .· -
.
I
-
c,, -'""' ,. . . , ;::::,
- . , r . r?.,..,
-- =
I -J --
$f;
':::>
...
.,.., c::::. , .
:,
: ::
,
.:..
,)
...,..,
--- -c
.... ., c
: :: :: ,
-
r::.-.c:s.. -.
r:-:,
-;;._;,c::
:-
::::, .e,- v . 7 . ',
--C-
-
:::i:-:.:J:, c:::-
.
...c::,c-,
:::::::- .
5_c:, . .. ,. :
,s=::
3=s .x.'-
-- .-0·
':)
"'I)
-_: :,, ......3 '"2::::- I
- .-
c:-
::>
3::
c::- 3- ......,.,..,
- :::>
-,.J....,
Cl) ...... -3
C
3
c-..c:0
,J>
-
-....
-..•G
...., •II
.
0-,
..... i:::: ."..",
... ....J
-· -
..,.
').
• . : .._,
,-
.. .,: ,
3
0=
l i,-l
1u.r e .. ..
Lisi 01l r1t1/0hle
r1ax = 9 .
.11 I N :.:: i .........
, r,nl If f
uni 1 lilt l 1
r11nl unI')
( 1 2 ,!i, i 1 i
Ir : rurle
!)
--Pfl'OI' .. ti
(i..- t 2 1 34 2 1 1)
rrimc 1 uf e = - i)
-uni i aunt l -t
) r11n1 C coufil_'}
01r·.
IUf Ie - (1 2 S 3 9 - 1 i,"'
.!)
1(Je.-=10:
- _: r1 tnl C _[ r91J.·-
sl 'ruld fl)
¥4C'Q ftlf\l l"nad • ' ·
1)
PP-.. Aww)
H 1ernoue c C'j)
Jh& fifW SE! ronla1n1ns th t llfi1cri Pr"1()\ ( 'Rell\ClJC - ,,, c,r)
• ts) of i].uo 01 m clf>f
e \f\s '·1 S(i i C; •'l•3.i1 •"i}
- RElu1n ,ne netu srt UJh\m
E fS(Ci'l(IO (e_ruy ('()ffifOOn e\Cffi(l1\ )
lldd • C.t ,,,a . ,,s ,gl
.-...-. . ..--....
. 1!1.0X :.. _s .
··- ..
(XII) R.,_.nces / Suggestions for further Reading
• bttpsJ/www.w3scbools.com,l'} thon/Pytb, ,n_,..,tt; '-''p
-.
• bttps://wv."W.ge1•k.,;forl(t>eks.org/set.'l•in•Python/
• bttpsJ/wv.-w.tutorial11point , ,,m/Python/Python_sets
• https://www.youtulx• rnm/wutcb?v::-MEPll.AJPvXY
https://www.youtubo.com/watch'>\•:zr3R3h51y_Sg
Aaaessment Scheme
Performance Indicators Weightage
... Proceu related (85 Marb)
1.
2.
L<1gic Formula lion
'l>obuning Ability
7lO'J
20''
-
3. Follow ethical pr1tctices 40%
Product rela (15 Maru) 30"'\,
4. Exoocwd output 10%
5 Timely SubmiMion of rB rt 10%
6 Answer t.o sampl,· qu,•stions 10%
Totnl (50 Marlu) I 00';';,
eam Members
a e r.r.os.-
uro1
l led - t Totalciroi -
Dated Sip of Teacher
:.....::::!:::========:::c:-:;..;--
o J.U.llll ·
S.E.Cl--
1 . q ;f!
&.- ... ..- . . -
.
e rr a rd. ...
nee .. .
lP ..ao.oo.le 1
........ face&e.ok 2 2
trlcmso ft
Qf.O. i . .... ... . .... .. .. -.. ..... ........
...
··········· ......'.I.OLJtUb
e.3 .. .......
Noa:Foc,,Uy m,uJ rmu.re llwJ rvery group of •tiuhnu rue different inputoalru.
(Usn blank sp.1et· for nnswcrs or attach moru pnges if needed)
(l) Wril ae Python script to sort (IISOl?nding and dl•.-cending) a dictionary byvalue.
(2) Wrilea Python script to cone11tenate following d.ictionanes to createa new one.
(a) Sample Dictionary·
(b) did =11'.10, 2:20I
Cc) d.ic2 = 13:.30, 4:40)
(4J dic3 = 15:50,6:601
'Wrifiat Python program to oombine two dictionary adding valueR for common keys.
C., dl • l'a' 100,'b'· 200, 'c' 100I
d2 = l'a': 300, 'b'; 200, 'd':4001
• Python program to print all unique values in n dictionarv.
&mple Data (l"V":"SOOl"l, l"\I":·s002·1, ('VI": "SOOl"J, l'VI" "S005"1,
···soos,.l"V":"S009"1, f"VIII"tsoo7•11
to find the hi best 3 values in a diction
olTechnk:al Education ary.
p,ogtt1mmJng wllh Python (22616)
(49)
[Space for Answer]
- ....
.
tt r j.. :C··o'·. ·1.. •••'b. j.:·· () 'fl' •3··0)· - •••
b - ..••••• DD.. I.. . • . ••v I., • • • • • • • • •• ••
. .
•h'.:. QO 1._cl;._' oo.1.
•
lC1 !) ==e {'O.':3O0.J
/'
OeW.CJ',w-l..:=•.'L ..'0 .: LJQD I I
'..'b.'. : 1..10.0·.·'·'C..'.
6
'1)0 'd''/
·····•· ..........
i..,,...,,... / Suggestion• for further Reading
httpaJ/wY."Wtutorialspoint com/Pyt.hon/P)1hon dictionary.htm
httpsJ/wwwJavatpoinLcom/Python-dictionary
https:/lwww.youtube oom/watchr.•::fAw8pM_dQP4& 1598s
https://www yout\1bc.com/watch?v::doefalgNkw0
-.......
---...
-
•
-•
Nul4'.: Fn<-ulty mu•I ent111rt> Iha/ et•ery group of11huhnts use different input r•alue.
(lJE-e blnnk space for answers or attach more pages 1f n<'ededl
Wntc a Python function t.hat acceplq a string and calculate the number of upp('r c:ase letters and
low<·r CIISl! lett.(lrs.
Writ.o n Python program lo generate a random float where t.hc ,·alue is between 6 and 50 using
Python moth modult•.
-
11111111 Staro Boord of Tecllnfcal Ed11c1111on
-
-; -,nr.ut [• r.nle·r sJring C " -
..
Pnof csJ - • • . ... . .
up·O
I0"0
Uf. J. 1ft u, • .. •. •• •
icf _i- ts.lower C)l.•- - • •• • • •• ••••••• ••
o c. . .. • •••••
f 0
····-·•-··
--········r'intc.··urper c.nse.-=''.,up) •• •• •••
-ilf; £ofer }Iring,, ....Hello.ICl.W.. --- - :• - - --- ··_.
H elI H0.LU .. . . ... ... . ... . .... - .• -• •. ..
... 12)
m,tuoc('HaUo', 4)
I-le\ \D
Hello
11e\10 .. ..
Hel\o
Board ot TochNCal Cducatlon -
-.r,,,....,..._,..llaal ""'Y,,._p of•ltulntta u... diffrrrnl input• al,u,.
CU• blank Space for -.n or attach morn tf ftf'<:ded)
aWorLita• P:,tboa funetion that l<es a numlM-r u a panunctcr and ehi,cl;. tho numbor ia pnm;,
Cl> Writa• PJtboo function to cakulate lho factorial of a number (anon•ncgaln'tl 1ntq;t.,,rl Tho
ftmc:tion 8Claepta the nu r uanargum.-nL
(3) Wnta• P,tbon function that aooept.11 a atring and calculate the number of upper auo lc,ttvz and
lower cue lettera,
1©.-:--+
def fuoc .cn') :
. fm- 1.. in .'.Tooneco. . f\i: i)
. j f n '/· I=- LJ _:
.. b rP.Qk
iF f
ipr n · :c o , : is . . ri_o/ a, Pnme" n·u rnb:er ")
n-.int c,nput c 'Ent.er number:•))
func, Co") .
o,r, roier..n mlier: ·1'1 - - . ·-...
, is a. not D.J Prime. numb.err
outrul e:_l . •• •
. £01er .sL11n.9 - li£l\D
L O L u e.r C O • • • •••
Su E.rr - f 4r c n. • - --- --
s e, . i
- -- - .. - .. - .. .. ·
Dc\eloproent Software ---- 1 1
lXPract)ical Related Questions - r,aL>hRnt m11ir,t ,.
' · fcor ,.,,-.
of : &-low git-en ore (tw ,ample qll" '"'":fild co-
N
qunfioru lo e,uu theMhi£relfll!,.t o(uk,.t 1
t1\ \\"hat is the output of the follo«i118' proP111I1
import math
pnnt rnath.sqrt(25l
pnnt math.pi
pnnt math degn--cs<2)
pnnt math rodians(tiOl
print lllAtb.l'inC:?l
pnnt math C051051
pnnt math.tan(0.:..!3)
print matbfact0rial(4) • ?
12 What II tbe output oftbc f0Uow111$ propan1•
unportrandom
print ,andom.raod1ot(O, 6)
pnnt ,andom.randomC)
pnnt ,andoxn.random()• JOO 0
Liat., ( 1,, . True. SOO, "Python", 27,"hc>ll "l
print ranctoro.d)oice(Li,tl
3) What i, the output of the folloWUI£ program?
importdall>time
6'11111datetime unport dote
impGl'CtilDll
prillt timLtime<)
print c1a1&fromtimt'!'tamp(454!l54'
(Space for Answer]
.. ----·
- -- ----· . - . ,_ .............
gWllhf¥hO'l (22616) . ....... ...... • .......
................. ...........
...--....- .·--·---··
··••• .............
--·· ------------··--................................................................................... --------··--------
.. ...........................- ........................................-.---·-···---·..·· .........................................................................
.. --
----- -------------··-··--- ----···-....... ....
(Xl) exercise
Note: Faculty must ensure that every grtmp of student, use different input value.
(lJse blank space for answers or attach more pages if needed)
(1) Writ.e a Python progTam to create a user defined module that will ask your college name and will
display the name of the coJlege.
(2) Write a Python program that will calculat.e area and circumference of circle using inbuilt Math
Module
(3) Write a Python program that will display Calendar of given month using Calendar Module
[Space for Answer)
. .. .
. -- . ---- • --- . -
··-- ....................... --
_
••······•• ···••··..............····•·-----···············
a . ......
'-I.. - ..5 ....... b. ..... t.... g .9
J\ _ ·· .J.'l .. ···· _13. ......l.'i
i··-
•••· 16 ..... JS ...16 ..........
• ::··jr_ ......J8.. .....1.9.... .._9= I . 2.·•··· _9.3.......·······. .
..................................
l obtained
Marks (36J (16)