0% found this document useful (0 votes)
17 views

Python Obs 6

Uploaded by

Vvv
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)
17 views

Python Obs 6

Uploaded by

Vvv
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/ 10

Menu

from tkiter impot


rogo ohot mer
moot Tk()
menu Menu(root)
poasM-w
root Cong(menumenu)
hlemenu - Menu (menu)
14
men oded Coscade (label =" l , menu-lenmenu)
ilemenu. add- command (lobel =" neuw")
tlemenu a.dd- command (label- "open)
lemenu. Odd- cepevotor()
ilemenu.add cormmand Clabel 2 " enit", Command

Yoot quit)
helpmenu Menu(manu nodootsho nor
manu.a dd_ tascade Clabel " help', venu-helpmun)
nepmenu. add command clabl- "about
moun loopl
OUTPUT
hle help
alou
Opa
ei

methods n meu!-
creales new menuu
l)
I O dd c a s c a d e
2.add-commond C)
3 a d d - Cepauator)

Meagt ron hel


rom tkinter impont
Too
maun TkC)

Mesoge (main, text-" ttu y mekaqe


Ul

VI:COn (bg "ugbdgreen", faqen)


-

MIpack t)
main main loop t lolollsbosdo h
(Ousn-lsdol) bnomomasbhonseo
OUTPUT
snooomos bbo ums
eroloaneasbounam
t n s is y
Dbnomnnos bbs

omtkinter impovt*
Maut er Tk)

vouable -
Clving o(Mat eu)
vasiab le cet Open")
"saut,
oi OphonMenu (Matev,vasiable, "Open",
Saveal
packC)
Mainl loop(
Master

oUTPUT

open

cove

Rarliobutfon
x
impovt
kintex
Pronm
moot Tk )
V-DntvaNC )
vasiable -v,
ton(voot, teat: "Male,
Radiobut
a . -R a c d i o b u
value 1). pack()
", vauable:
vauableV V,
tent"lemal",
ton(voot,
b Racliobul
Nalue 2). packt

not. main Loop(

OUTPUT

Tok
OMale
Otemal

Roma
conveyt inteqer to
PyTHON pYoqram
to

numeyal
clous pt
num):
de int-to-row(selh, 90,50, 40,10,
So0, 400, 100,
V a l t o00, 900,
9,5,4,1

M","cM,D
cD"e",ye
xc,
sub ", 'x","Ix ",IN
Y o m a n - n u u m

while (num s0)1


ohile (num>e)
(nurm//val[i):
-fora ange
Y O m a n - N U m + C y b l i n

Yoman- num
=

snum n u m -valti7

Yeturn Yoman-nuunm

vonman (3549)
print (pi(). int_to
OUTPUTL
MMMDxLIX oh,loooorlodo

*elas P2
de pauo(sel,y)
==0 or | OY U==l:

retuYn

= -1:
y 2 - - O:
return

ese
return-1

retuyn

tun pous ( ,

pYintlp1(
) pow(3,-3))
OUTPUT

0. 1250
Comm

e b br0vore
Cdwoater\oce) o
/ 7 7 / P
HTTP
Raspouis
Dolta atu
Sevver
600 Poqvorn
elient ask
client asks to
fov
ebpoge, C61 woks
voubpoqu
at

s cernaltleroorvo to
L G LT u c h o u
boudl mqu
oC) ->u wed t pa o
query tn t
environment ov vom dil
Cai rwltipotC)->uyed to poxte tuu ilP
ype wultpont 6
.paNce heoder C)- MIME(wultipurpoteivudennet
entmOUL)
Cai test C)-s all Ltml pr

HTTPleader&-lead ttu elivut cévver pa


addi tiovaluorwohen uoitt o Ltp nequest d
a repOULe

be text g
Coudeut typt- oich
coun

npies
loeathonm
Set cookies

Coudut-laqth.
nvivoment Vasiablel--terit4 ielelu,
o t tt webse ve ceud to avey ca uolue
ou vun

Document voot Yoot divectery o ta ceve


VU

HTTP-cookie vicid cookie


HTTP-Host hott vou t poq
Covipt-le name Lluu full palU vauu
CUYede
ath potuauma t u cuwYeud CG
wttpt
tlp-LUr-ageut
Sevipt name
C6 pYoqvom wwivg pyfthor
Conquve webCenve
Opthon ainactovn add audleyc
hite tu C6 empt n tt comect orma
Sove tt tile a dieut diveco
Kun ttu suvipt n ttu u
x PyTHON to
oam input a text te'and
relun with unique wOvde in alphabeical
odex
f2 open("4 tat,")
t . ustc
fov une in f
ooYd= üne.eimpt)-cplitc
-foY element tn w0Y
elenent in ut
Conthnue
else
oppthel(elemant)
sovt)

intt utar osst


O U T P U T

Rnge', tot pne',tRin', thina, tkink]


eVTHON pooam ot pvOnpt 1he ugey -to erder
rumbr betucen 1-7 5:un ditplay 1he
coYmexponaing doy of tRe we ek
nt (input (Enter a number voo 1to 7."))
pvint(1 Suday") r
n-2:
print (2 Monelay ")ce dugor h
eb n--3 admun
pvint (3 Tuetay)
ebn-4 d snluslo or morpor aotTvs

Print4 Wednedau
eb n adinan dan sdofuor) om
5
pvitCs- 1hur cdau") ugor) dot-n
l n-6: Opmu
print (6viday)0,m) spror oi o
eli O-7: d benmu
afopvintC":Caturday")b jo mua )doing
elue uu2
print Ctrter a valid numben) Tuttud
OUTPUT
Enter a
number vom to 77
csoloun bnoss n
7 Satur day
PYTHONN proqYom to Hake input
orn t
usUY
h e theckohether it i o
Y chanacder 3 it u choroacder del,. urb
whether itu ppevcoge OT
uweCo
input(Enter the input")
nunurneric ()
14 i
Print(
o.number")
lpit uupprC3
print( Uppurcase")
ee
pYint Louoerco4e")
OUTPUT
Eter the input:55
t u rnumbur
a jem
Py1HON proqrorm to
-frorn rnto coleulate turm
Curm oof numbey
m-int (input(Entev ivst numou
n-int (input(Enter number:)
Sum 0 ttcond
fovi in
numbev)
onge(m, n+0 bel )boe
prrint (sum Lum-tum+i
of the

OUTPUT
numbertrorn, m,"to",n," w,
Surn)
Ent or mtt nurmbeY:
Erder Cotond nurmber:4
Sun ofthe numburc
rorm 4 to b u
S
PYTHO ON PYogam to Prirt
mulhpli cotion table op n.
int(inpu Center o numbUY:"))
i n iNange (o,6)vbssiC) c 26ostosub
print (n, , ", nxi)
O U T P U T

antex numbey

5x 315
5 4 20

6 5 2 shnas s
PYTHON
PYogam to nd the um
ot tquaru o
even numbere

de CquaveCum(n): spco s
etun t (2* nx (n41) (2* 0+1) 13)
buu souare tum(2)
PYint(ans) b
OUTPUT
(Cboe
816
xPYTHON pYOqYam on factova
def acttn):
C3s2ols
return 0
elue
Tetun noct(n-1)
fact(5)
DUT PUT Aunomas
12.0
bssd-iam ooitp
Umitfor ecvCIon i
tmport y python
sys getecurtion Gmit)
DOTPOT dos/ktlunt o
3000
Dicadvantaget of vecd
wYSIOg
Acdvantaqet and
Avantoqu simple
eleqant 4
ICode very subpyoo
2. Task can be broken into many
aom
Dicadvantoqel it tot..
colle are vevy enpenive
as
ku
1Recuvsive

enecution 4 debugging
ime -for o!..
pYoorarm to apPend The content
PYTHON
to ut tile (reod2 fle name ascomma
Line anqumentu)
K2 py
impovt u 'a+") #tl tl
-open (sys angu[ ,
open(yt ovgu[:],"7")#2ud
tile
1Ovite(f2 read)
ft-open(sys argl],'~)
pvint( t veod))
s o t no ruorporg 101
1.close )
2closeCt).
Pivet trt
kakeernan Sveyo leddy.
Second i a t

kakumanu

Ipython ka
Py fnt txt teecornd.tat
OUTPUT

kakumanu ua Reddu

You might also like