Name Rudra Thacker
251037109071
D Explain the
vatl
both __powitive = (vatl > 0) and (vat? > 0)
intly Oddition: fadditions, Medutue:
Frodetee
printly he the pinet greeter? die greater)
Write a program to cheek whether a number
ie _ wen on odd using iprebee.
Python code
number > intlinpudl’ Enter an integer: “))
if number een):
eed ie an)
lee:
princely Snumber ie Odd.)
Yenerate alt Onmetrong numbere between | to
1000.Name Rudra Thacker
2510310901
Python code
fem tam in Ip 100):
nim or = nam)
power = terlnaum_—etr)
ip sumlintldigit) ** powtr fon digit in
num —etr) == num?
_
Explain nected if ctatemente with a reat—tipe
Fon mont complex tit nected if
tatimente art incredibly uereputl, Think of a
system vinifying catdentiale fon an internat
company portal: pinet, it checks if an
authonintd ustr triete in the databace; if
it dete, it dives inte a nected if to vrrifpy
their sptcipic adminictrative aceter Wet.
Python code
Utr— authenticated = True3)
Name Rudra Thacker
2510310901
if uetr authenticated:
ip access acts == “executive:
print! Futt optrational dashboard acct
granted.)
hee:
prindl Standard imployte vitur granted, )
elee:
printlAleer not found in the dinectony.)
Write a program to print the finet IO natunat
nambire using a white loop and. explain ite
uronkig
Xoops are puet ac vital a+ conditionale. 0
while loop rune a block of code
continuously ae tong At A 4plcific,
condition hotde true. To print the fet,
lOnatunral numbtr«. Yor initialine a counttr,
loop white it ie bee than ontguat to IO, and
incrtment it tack time to prevent an infinite
loop.Rudra Thacker
2510310907
hemonetrate the ust of brtabe continu, and.
pare statimente with rxamplee.
Uneide loope, controtling the exact flour
rthite on hbrtak, continut, and pace
stotimente. hritak completly exite the loop,
continut «hips the rect of the current
acts an a placthotder when syntax require
a tine of code but you do not want it to do
Python code
for iin nang):10)
Rudra Thacker
2510370901
pi == tt
pace + Placehotder for puture logic,
bf == ie
continu + Stipe printing a
ip == At
break +t xtope the loop i
printli, end=" “) + Printe 0, 3
Create a mini cateutaton that waluatee
arithmetic, taprtesione using conditional
logic lip, Hip and. ebee).
Python. code
, operator, nZ = 10, 't', 9
if cperaton == '+':
printinl + n2Z)
Up optraton == ae
printlnd — nZ)
Uip optrater == |»:
printind »* n2)
Ui optraton == YA
printlnd / nd ig nd ‘= 0 etee “hi by sereiD
2)
Rudra Thacker
error)
White a program to pind att prime numbered
in a given range and compute thein «um.
Python. code
prime_ium = 0
fer nam in nangullO, 5):
if nam 7 I:
for iin nangulZ, intlnam**O.5) +):
tb (nam ‘h i) == 0:
break
ee:
+= num
primum
prin em, Ch primes: dorian, eum")
mplement factorial and. Fibonacci using.
rtunsron.
Python. code
dep pactonialln):1)
A)
Rudra Thacker
netunn | if n in (0, ND clot nv * pactonialln —
dD
dep fibonacciln):
return rif nm 2= | bee pibonacciln — D+
fibonacciln-2)
Explain ring cprratione and for
with example. Write a program to check if
a tring it a patindrome.
Python code
test. = “racecar”
ib teat == aE
prindl bt ie a palindrome")
hipperentiate between tet and tuple. Write
Python code
my—tiet = [a's 'b'y ‘cy15)
RudraThacker
my —tuple = (I. 20, 30, 40)
printlmy tied |:F_) 4 Sticing a list
printlmy tuple 0 |) 4 Mndexing a tuple
Explain «tte and dictionarite with rxamplee.
Write a program to add, update, and delete
Umente in a dictionary.
Fon unendund data, «te and dictionarire
ant inentdibly Upicient. Bite hold. Unique
iteme while dictionarite etont data in pact
key-valut pains. With dictionarite, adding,
Updating on deleting. lemente table just a
tint of code.
Python. code
= o nm? Quine, W [b “Q26°%
dataltocetion | = “Yujaret’ +t Odd
datal model | = “CFO-as-a-Sewice +
Mpdate
det dacal pin! | + heteteRudra Thacker
251037104901
Io) White a program demonetrating the Uae of
built-in functione (tn, 4M, MOK, Mins, ayer)
on ticte and tuple.
Python code
metrice = [I5, 2, 8, 22 |
print “Mas: eincnies) a Sumi
ol Length: Senlmetnier) >
mM
Write a program to count vourle,
coneonante, digite, and special charactere
in a ain
Python code
= “Python 3.10!
vowrle =