0% found this document useful (0 votes)
4 views16 pages

python_assignment

The document provides an overview of Python programming concepts, focusing on data types such as numeric, boolean, and collections like lists and dictionaries. It explains the characteristics and usage of these data types, including examples of operations and functions. Additionally, it covers membership operators and basic programming structures in Python.

Uploaded by

ozagautam08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
4 views16 pages

python_assignment

The document provides an overview of Python programming concepts, focusing on data types such as numeric, boolean, and collections like lists and dictionaries. It explains the characteristics and usage of these data types, including examples of operations and functions. Additionally, it covers membership operators and basic programming structures in Python.

Uploaded by

ozagautam08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 16
+NEME: Ky pRallno: cs22048 Ba ee at Subject : Programming ait python =~ ___ aiflsiaie ond explain built ia ak =| pata up data tells ond 1 classe, Numeric In_Putnon [to store . multiple . values io, on sh_Mukesh Tinary min ypes of funn. Whot _apgratar, 10. Parh'cilar data an be performed | Puthan _praqramming , data x tastances (object) oP theae [Fatiowing are the builk=in dato Numeric cata type represent the data _ has oumertc vatué integer, floating Qumber or U hese yolues are defined a. whi Numeric. value ink font and Somplex @ *—ordeved_salleckfon of or_different cies ie Allows oe These are several PPato type wit one oP the Luo buitt=in values False. Boolean objects thert axe _equal_to_trus —___I/eruthny Ubrue)_, and nose equal _te ylse ave fa)si ___llcraise) _ gut non= Boolean objects canbe evaluates": lin Boolean context as well _and determined tet ltrue or False. Tt is denoted by the clase Nae eee —l nove ‘tT! means trae and _'F' means false other Python, ill throw an error 2b is on unordered collechon 6 “dato In type that ts iterable_mutabl ‘and hay 8 sek on ae duplicate elements. The orde~ P elements ia oa i (perl@binodt ang He nay consist ob _vaions ——_ Onset. joordeved calleckian of data. aluer like ao map, ushich— that holds only single —_—_ cary ‘nalds Aseya value —_ inthe _dichionary te y__hey- valle parr (ONAL USE Python - Data types [Numeric DictYonary Boolean Set Integer Float Strings comples number ist jONAI- USE, Membership _operaiars: ae eas Mernbership operators ore used to Lest, Eo sequence Is_presented 1 1 ECE ce SEN meee Operator in’ Returns True if o sequence uw ith the tact | specified value is presemt inthe object RMSE example: x In y aa Operatey ‘nat tn) + Returns True 1f a I Vv i exampk ¢ x not in Y. a or a Tee ii J __print Go) Ss for require a inde DUCATION AI. USE USE, 3 List con se nested among al Lisk is mutable i.e. we cad mole 2 any changes i inn 4 ve is ordered. tei fe 4 ecacnple £1,2,5,4,51 a zs | pictiona»§ ie also _o_non= -hamageneass— date. 8 ru chare — Di which stores kewy a _valne pale nese eet | I pickionary can be represented by tt ob ill nat allan aly duplicate ~slecnests Ars icles liclionary doesn't rae Neu keys Sie ses ake) onary is ordered se Caen’ & em and abou exampl 2 "Brand". “Word , model": "! muytang"! 2 year: “19 64 nt eS \wihot is Jontbda Banckion in _pytoon 2 Explaia_uaitin.an— ecacaple ANS Python ipenbsia functions axe —nnctlinel a Po Wie ¥ weang thet the Punckion Unitnout a aan Ds aay and ang aaa areas P 7 ———— the list sith _examgle in fytboo (9) Tndeciog in Python: tH in Python of an iberable by cneans referring to an elemeot = its _poatttan _yaith _the irerabes ng__their \odex number ~ leach character can be accessed using at c at ix as Fowilive index number a ? negative ind nucnber 7 ae pimimcardens =\|ecam ples ia ae wg strLol) aa pantLoy Persorm the Consider se _sbing TSA ‘Hello Hous Bre oYeu2" uae cae San a | print Lo) i a4 | : a8 place ‘You' with ‘beg ! tet slla= s4 replace Yau", Dag ) Me printia) oes IL é | ——| Repeat the same —stving 10 Mmmes by bi _yepetivon - S4* 10) a F Concatenate 'Tam fine! with S4 ee a print (S4 +'7T ora fe") ates s i acd Given he Tuples T= (01,2, (Heito!, 1,12, “Pytnon!)) Al22 ,[5, S2("Zaqio", 13, YSamia'!, 12) World], 4) 43 — +Form. ra get a a ess 2 Ne ape Hans Lo 9 the oe Ub pu es 2% all Find the Length of T and matsh it with youre — understand aq _ oxink (ent) : output: $ ¥ Weve, io thir Tuple there ore tuple list 7 o Oo 0 ele! Mi Wy Wb Hello’, 11,12," Py thon") a= po "FOR ED JCATION/}. USE a b= 9 02) priat (pou) - |output =P | Q= TTot | b= Of 2) |_c= bYS} print (cL) Output : 21,22 print (TEI, 4" 7 £29) aw °C ee Stree es Ue iee aie ee te i = Trash ays b= alst — = ce. - print ( bLod) = . puck: | a=Trs) b=eaSs2) print (b C-11) * Consider the Mist p= [h 43), 14,5) (4 7,089,101 M2) ts), (14, Hello LIS, "Python", “HTML T)] Gul Write python code to get the follausing outeut £3,419) ee —— CATION. USE a §6©$\"—_ ih ea ea a erm a OL SCR d 1 Consider the same list 1 ao perfor, = Aes Poltouatag - operations oo it~ @)| Replace !Hello! by _!Hi! fe, A= list Ors) Fabd = ui! ibe pop(s) 4 extend a print (a) (p\_Count nccurrence of 10! joo = list (LOS). ie al} o.pop(2) <=atb 4 count =O =) for jin C+ if yee) == Sty: eine ip pee to zs aie = i ailpint meme toMmeco uct) we _cannol tind mon 1 Create the dicWonary in differ me way. woing the ou 1 following keys on carxes ponding, ual ys = On 2,5, 4,5, 2/5} es 4c ae - {ie 'B ‘ce! Dye! ‘ent Sm Scenes! FI Priemici qb! a SEEN sy amie aa - 8 wil i t_eleme nbs —_— er than SO fom give Ligk Suppose List 8 have a mo of elements =O while i<# Xen (A): if ari < 50: “count = count +\ he eel a ———_IlGount and —_erin® __the number 0 gosibive , — | ve _ond__2era elements in the _givea list —— Us Ing. for laa Pp 2a: F list = [ifort in ranges, | I count 0=0 count _p=0. ont =0 MoH =O" for iio. rorge list + EE eee count.O += 1 elif {70+ Cer ee dik i<0. ie pone coont_a as

You might also like