!
Ts object Oriented
+_GUT_Programmin
Audpork
High = leiel tae a
= Python (5 Portable
|. Python i Toteqrated Language
! Explain Puthon Path
| CuTHowpATH {6 an environment yariah
tact to add oddittonal You con set $p
L_cliceckories here Putho ‘
1 packages « for most installations You shoi
[these Variables 4tince they ove Not needed
to _run Python knows here tp find tt,
library.
Ook bor module
Exercise
1 Print the version of Python
Amport §
PYX ovint ($43. version)ytechnic Dhale.
“Tet — ‘oe
[Prper(oent Name t= [rite i
{| ___ Simple Python to eer
on ema a!
4) Practical Related Questions
SMDR Goverment Pol
bi) (eb dieeerent mole alge |
=| i) Toteractive Mode ;
| ti) Batch Mode
al Decist ing interact
|| eoode.
| The intevactt eos { i r
I e Pi res t Fr
|| terminal, of the Operating « Script
| have to- create a ile give it a name with -0.(-pq) the
7 7
extension yun
mode 75 uituble ther i a li
bint the Steps involved in executing -
Seript pale
4 File NewFile or Press Chrlt N
Lirite the Python Code aa function t-e- Acvig
it ce
; ; : jng_RUN| [Camntin| rage
| State proced to make i executab in 4
| Python.
» | Gkep 4 te Add Python to Idindows Path
__|| Gtep 9 4- Dpen— bh indows Command omp
step t- Tinstal he Pyiinsta Package pip install
py installer
Step 4 t Save yo Python 0
rep 6 t= a ne i na Pyinstal
Step 6 Run + a
| Exercise
[rite q Python program to display your ome using
Tnteractive Mode.
>>> print (Your name ta t+ input (‘Enter the
Nome'))
fate the name xz
Your mame is 1 XY[Espeiment Nee a
| Branch course = Compute
|S5MDR_ Grovertyment Polytechic ; Dhule (Comnin|reee
it Practical Related Quest
Mention the use of
ONS i
Ee
# Division (loon) of a
umb er
[>>> diva -a/lh
>>> print Cdivs)
Oo.
F_ Power
>>> OP - akth
print (p)
>>? Mod = Ath
>>» print (mod)
§.[Camiin] Pace
‘this Python Operator cansiss ob thers Operands. Tha
ternar Operator con be thought pt asa simplitied
[Tone fine ‘version of the #6 aPlae Gtatemintte eee
| a condition,
I | Gymbax t=
|| The thre i v t ‘
Condition + A boolean expression that evalutes to either
true or false.
Ef fe e ti i if i
Le Cualuated -ro true
|fulsewal ‘=A value to he assigned if the expression (8
| €valuated to False
Describe about dtfterent logical Operators in Pathan —
3)
Lith appropriate example
Logical Operators qveceth aan or, not Operators. ___
Operator A
and ‘True if both the Operands are true «and
or - True if cither of the Operands {5 True Kort
nok - True if operand 15 Falce mot x.
x= True
uy = false
print C:x_and_¥ is x ond)
and \ 15 false+ . a
print_CX or US eScO rae
__X_oy 44a
Print (mot x is‘ not x)
Oot x 15 alae
Aithmnele Operator are used form mathematical
Operations like addition C+) J geen walkin
division (7). modulus (% Floor division (17)
exponent (e *)\ =
£ ample .,
4## Outout <- gety = 414
print (\xty=' x+y)
print Cx-y =! x-9)
Output 1 x-$=2UBituise
as if they Luere
= Strings of bi -Aigits They _opnatea bit by? ibe
—} hence the name 7
_ ee
[Example het 1210 (0000. 1ole) 7 Th Binney
ee 424 (0000 _otov)
I Operator Be a Example
HL Bitat ¢ AND XRY 20 (0000 pov9
t | Bitnise oR %14 = 14 (0000 (110)
Leu Ritsise not wx <2- (11 oto’)
HN Bitnise xog AY 214 (onod ‘bots
> Bihaise righ hié K250 = 9 (v000 polo
Greater than qual to ia s=h
Differentiate between if-else and nested it
TE - Flee
546 statement tells thati “elit (ov oumsys 2 kee
{_ . Largest = NG yan =
Largest = Num 4
|| _ovint (The Largest fumber {5
a Largest)
| Output 2- Enter Pir Number 4 ug
a Pnbey econd Number MS
fobs Third Number: 44
The largest number 4s 55.0
Lap to check {¢ the input
f year i 0 loop year af oy
Aol.
Year = int (input (“fnker a yeart ‘))
if year 4) ==05
if Cyear "109 2
°
if Cyeaws Yoo) = = O35
Print (“£04 is o lean year" format (year) ws
p
else!
print (fo is not a leap Year "format (yeu) a
alec:
print (“fot is not e rt + (yea
elae
print ("{o4 fs not a_teap years format (year) a
Enter a ear 5 2001
Mort in not o_teap yearka@ [Comin] race
\ 4 —feuntag ‘Mogesh Devs.
| Not- $29 Branch ‘- Comput
ject t= Puthon Froeriment Mo i= 05 |
[experiment ame $- WAP to demonstrate l
_use_o€ looping Statemen' ts 4 “phile' loop, Sign
__\for'loop and Nested loop
i | Pract cal_Related (Questions
hat would be the Output Prom the follasing Python Code
eqgment ?
a zlo
| While a >5 +
Orintex | A
|
iL
[thay Tas Sclasg Donoal
| to for loop
ee =1
while %o0)+
Sum += num ae
Num 224 2. ee er
int CThe val :
(Enter Some numbers: 4)[Comitin] Face
“SHO
mwaP to Caleul (ace can Tahaan
— Hal of a nine
um = {nt aaa. ae umber) ie
rac =
fe Inum0):
digit = N% to
rev = rev # lo tdigit
ne nillo
int ("Reverse Number <1 peu) a
Enter ony Number + £2345
Reverse
Qumber 3 643 04