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

python basic progrmms

GHJKL

Uploaded by

Tejashwi tejuu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
5 views

python basic progrmms

GHJKL

Uploaded by

Tejashwi tejuu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 6
I]. Puthon Proavam +o | aiven § a oes __ start 211 end = 75 _ ___ Print (“prime numbers between", end, “are:") fox Ci in vange ( start , end a ep>pe for jin yange (2,i 9: if(jyT=e=0)+ Prime number between tL and 45 ave : li, 13 19 14 23 29. Bl FF aq isa ci 67 ail 32 woqxarne to Print squave of atven umber: Code — __ num = int Cinput ("enter number: “ _Squave = nn _print ("Square js +", Square ) Output: enter number ° 10 Squave is 1 100 3). Puthon proagyam +o pyint table of given number: codes _ N= int Cinpur C“entey the number to pyiat table fox. ")) for jin yange (I, )? _ pxlot Ci x n ) . Output: enrey number to print table for : 7 put jon pe (Linke pin). Nores cracls TELEGRAM, ced 4). Python Progyam tO _@dd_+wo numbers: a oe : - Sum= Numi + num 2 ~ - - print (The sum of {Oo} and {i} ts {ah ___ fovmar (num, num 2. sum) pt 5: Python pxogyam +o pyint calande Code : Ss imposting calander module _Impoyt calander = YY, = 2022 a Year eee reece! [eee th displaying, ng_calandey fit tances 9 — = —,Outpur + — i Nov 20: - = Mon Tue Iwled “Thu Fri Sat L gz Si 4 3 g q 410 u 1S Ib We 23 24 30 Puthon pyoaxarn to _Swai Code: Jee | Oe _ aa Swapping of number _usin ng third vaviable temp = x fey Y= fem ipyint C' ae of x after Smapping : O' format (X) ») ____ print (‘value oF y_ after swaping : {> foymat “oe Output > Value of x after Swapping + Value. of Y Afrer Swapping : 5 num +1) i fact = Factei =e print C"factovial is: >". fovmat fact )) Output: Factovial is ! 5040. program to Convert decimal to Othey Number _Sustern. Codes dec = 344 pint ("The decimal value of", de evint(bin (dec) , " “in binayu print ( Oct Cdec ) in Octal. Output: —————— The decirnal value of _Oblo1oilooe in binary Ooszo jn Dera Ox“ 1S@ in hexadecimal am _ tn print a *# n TUS = = Int (Input (“enter nurmbex of vows i") fox i_in range (wows al _ fox j in vange (i+ 1 plat _ pri en") thon pyogvam to find |.CM* Code: def compute. lem Cx, y_) _ if x > 4 = eater = = x a alles thon pyoayam to add two matyice. e Vode: for iin yange (en (XD)? | fox} in vange (lenty))? I - yesult LiJCI) =x Cills)+y Cis) th fox yin _yesult : | print Cy ): : _—p aie seers) Lio, 12, 9) Lu, 13, 18) def s um (ayy): : tum =O _ ei Komen, Cyaan ny). fox iin ayy: APT LER Creceanan) sum = Sum ri ______vetuyn (sur a yy = C7 avy = 012,24 15) n= ten layy ) ans = —Sum(ayr) i of the ayvau is: —___©utpur: Sum of ARRAY TS 24

You might also like