0% found this document useful (0 votes)
8 views17 pages

Data Types

Data types

Uploaded by

shubham sutrave
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)
8 views17 pages

Data Types

Data types

Uploaded by

shubham sutrave
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/ 17
Data Types 1) Numerical Data types represents whale nunbar (We or = + fost + complex reniy part can be float or tnt (ove on ve) meas mlalay Type casting or type conversion or type coersion. \Unepparted Cl Type. Double cick to inane he cnt a putt "enter the age") type) Y atrtoint Dbrire(tbefore type casting variable data type 1s (ype(ay}") # enecking earatype Ba '= ine(ar) 8 type casting DSrinctfratter type casting variable date type Ss (eye(say)") # checking type ore type ating wrkaie fata eye a css sts Y. Tinto float lne((* a= (G) and dota type Ss (typela))") checking datatyoe brine Die Heat(a) # type casting prine(#" 5 = (b} and gata type £5 {ype(by}") # enecking datatype Dbrarc(#" a = (9) and eats type ts (ype(a)}") # checking aatatype prare(o=8) Sie eteat(a) # ype casting prire(# 5 = {b) and gata type £5 (ype(b))") # eneklng datatype = 58 and datatype te class ines ¥ 2) float toint 8.8 9 tang user Sraut 3.= (a) and eta type ts (typela))") # checking datatype priretvere). Se tnetad # type casting Dprire(#" 3 = (b} and gata tye £5 Cypetb)3") 8 enecking datatype bbe 58 and data type 18 class “Ine™> prirs(#" a = (3) and asta type tx (type(a)}") # chackng eatatyne brine Be tne(ay # ype casting Dprire(#" a = (b) and aata type £6 {ype(b)}") 8 checking datatype Drine(#" 2 = (a) and gata type ts {typeta)3") # checking datatype brire(os) Se tne(ay © ype casting prine(e” a = (By and asta type Ss (lype(b))") # eneklng datatype 3 x 58.7 and data type is 12'> {a} and cata type As (tyela)}") ¥ checking datatype a) Be tnt(a) # type casting Dprins(i" a = (B) ana asta type 4x (type(0)}") # enecking aststype 2 = 56.9 and data type Is Yintto complex 22 35 4 taeing user Input ne(#" a (a) and data type Ss {type(a))") # checking eatatyoe priretvere) Ds complex(a) & type casting prire(#” b= (O} and data tye £5 {ypetb)3") 9 enecking datatype b= (503) and date type Is «cla55 “complex > prirs(fe_a = (3) and earn type tx (type(a)}") # chackng aatatyne brine B= conptex(2) ¥ type casting prire(#™ 2 = {b} and gata type Ss {ype(b)}") 8 ehecklng datatype ane dota type As cclass “ine'> bs (250) ane cate type 1s Y- float to complex. Drire(#" 2 =) and gata toe $5 {type(a))") # checking eatatyoe brire(-s0 Se conplex(a) # type casting prirs(te a = (B} and sata type £s (yp0(B))") # eneklng datatype 2 15:58 and cata type 16 class ‘float’> 2 (Cas sb) ana dots tye a celate “comers Srire(# a= {a} and gata tye {lype(a)}") # checking datatyoe 0) Ds conplex(a) & type carting Dprire(#" 9 = (O) and gata tyoe is (ypetb)3") # enecking datatype boo (15.503) ane cata ype ts celass complex’? Y complex to int 2 35 5 6) # takdng user smut Srine(# 2 (2) and gata type £8 {Lype(a))") # checking aatatyoe prine("*reny Be inctad # type casting rire(#"'9 = (b} ana gata tye £5 (ypetb)3") 8 enecking datatype 1st) ad date type ts class “corplex’> ‘ype eror Traceack (nost recent call Last) “Mfoobats\ocat Teng tpykersel_5748/408n813574.97 18 snodule> Diprint fae {a} ane entnsype in (type) w checking datatye printf © (ef and eta type Ss (type))") 4 checking statyoe Typeterors can't convert compe to Sot Y complex to float a= 15 5 6} # taking user nut Srine(# a= (2) and data type £6 {lype(a)}") # checking aatatyoe brine(nsey B= fost(a) # ype casting rirc(#" 9 = (b) and gata type ts (ypetb)3") # enecking datatype 2 = (15005) and data ype Is Drinc(#" a = (9) and esta type ts (typeta)3") # checking aatatype brare("="8) Da ste(ay # type casting prine(e" a = (Bj and aata type £5 (eype(b)}") # evecking datatype 32 a5 # taking user input Drane(#" 2 = (2) and Gata toe As {type(a))") # checking eatatyoe brire(csey Be ste(a) # type casting prins(#" a = (Bj and asta type Sx (type(b))") # eneking datatype 2 2 15 and cata types class “tne"> bo 4s and data type ts class ‘str"> Y floattostr Dbrire(#" 2 =} and gata toe 4s {type(a))") # cbecing eatatyoe brire(sy Be ate(a) # type casting princté” a = (b) and asta type is (type(b)}") # checking datatype 1 sata ype Se celage ‘flot'> DSrine(# a= {a} and gata tye £5 lypela)}") # checeng aatatyre brine(rereuay Ge ste(a) # type casting Dprinc(#" 9 = (b) ana cara type ts (ypetb)3") # enecking datatype Y. strtoint 27257 taking user drove Grine(é™ a's a) and data type Ls (typeta)}") # checking datatype priretvere Ce tnctad # type casting beire(#" 3 = (b} and eata toe £5 {type(b)3") 9 enecking datatype 5 and ata type 36 class “ints prins(f= 2 = (3) and asta type ts (type(a)}") # checking aatatyne brine Die trea) # type casting prire(#" a = (B) and aata type £6 {ype(b)}") At eheckdng datatype 2 = 15 and data type ts clase "str’> ¥. strtoint Srine(# 2 = (9) and data tyes (ype(a)}") # checeing aatatyoe prinet"*renay Be ine(a) # type casting prirc(#" 9 = (b} and asta tye ts typetb)3") # eneckdng datatype {sar of flont can't convene eiectly into int (a) and ata type 15 (eypelayy") # checeing tative brine("*euy Ss aest(a) # ype casting pranc(t" 9 = (B) and esta type ts (eype(b)}") # enecking datatype brireto=8) Ca tne(e) # type casting prine(#” © = (2) and aata type £8 (ype(e)}") st evecking datatype 2 15 and deta type ss class “sMe'> Y strto oat Ddrins(fo a = (a) and asta type is (ype(a)}") # checking aatatyoe brireto=8) Se eteat(a) # ype casting prire(e” 5 + {b) and gata type £5 (ype(b))") 8 evecking datatype Y_ strto complex. Dprine(f" s'= (a) and asta type ts (ype(a)Y") # checking estate brine("="=8) Oe conplex(a) # type casting prire(#" 2 = (8) and gata type £8 {ype(b)}") 8 eveckdng datatype b= (150) and data ype ts 2215 50} # taking user Soput brire(@™ 3 = (a) and asta type tx (type(a)}") # checking aatatyne brine Die ste(a) # type casting princ(e™ 9 = (b} and cata tye Ls {tyoetb)}") # enecking b= (150) and data type Is Revision ne co float, str, comptex fr to int, float,conpex { str of float to int directly not posible refer shove example) = Cent (Yeter age valee?)) Srire(fe a = (a) and asta type ts (ype(a)}") # checking aatatyne brine enter age vale 35 Sand. a type Ss ceass “ste"> = evan(inoue(Venter age value?) Srine(f" 2 = (3) and eota type 4s (ype(a)}") # chaceng catatyoe prire("e"y enter ag0 vale 35 Bn 15 ao, ata type 15 class “int'> a = evaltinout(Yeter salary vaie")) Srire(# a's {a} and eata type £5 {ype(a)}") # checking aatatyoe prine(eeay 2 (aput( "enter salary vaie")) Drarc(t" 2 = (2) and eata type 25 (type(a)}") # checking aatatype prireto=) enter salary value 15.07 ingut(Yeter story value) prire(f" a (3) and eata type 4x (Kype(a))") # checking eatatyoe brine |= tnefevan(inut( “enter satory vaue'))) Srine(#" a = (2) and aata type ts {ype(a) 9") # checking datatyoe value 15.699 Sa type ir claee ‘ints 4a = ane(evalqinputt“enter salary vaiue"))) 1 peine(#" a {a} and data Gye 1s {LypELAD!) checking datatyoe math cell(5.8) # top rath, #looe5.58) # lower our s.58,0) ean s.s2588,2) ound. $82088,3) Y. Text Da string is collection of characters surounded with stale or double on triple or single triple or dole triple quotes 2 ahgazbegsh vas" 4) we con rot use single qucte in single quote 2) us con not wie eauble quote in double quate 2 ‘ahjgazbeish cass" Seta) Gr triple on tingle triple on double trople quoter" type) Gr triple on ingle triple on double triple quoter teeta) strt = Python's elas priretstra) Fe “c:users\aanin\Appoata\tocal\Tenp/pyscrrel_5748/398128335.py", Vine 2 stra Pytion'e clas strt = ytnon's classt praretstea) te “Cusers\eansn\appate\Locan\tenstoyiernel_S748/40LA9570.p9", Line 2 stra "bytwora chess" sted = “Pythons clase” escape character \ prinetstra) ytran’s clase strt = "Python's class” escape character \ priretstra) ytron's clase Stet = Python's class" escape character prire(stra) ython’s lass ert “Weare Tearaing \2ythor\"* # escape character \ Meare 2earnt priretstray rythont le are Learning “Python” ert «We Vare\" Learning ("eythen\"" t eseape character \e are learning “Python” priretstray We “are? Learning “Python” Stet = We are learning "ython"* # escape character \ Ke are learning "Python" oriretsteay concttions 4) we can ot use single quote in single quote 2) ue Can Rot Use double guste ir double quote stra “ie are Learning Python’ # escape character \_ Weare learning “Python prinetstray Fe “c:users\aanin\Appata\tocat\enpLpycerrel_S748/2751836738.py", Line 1 ‘strane are learning ‘Pytnon'" # escape character \ Ke are learning "ychon" \_ Escape character ert = we 'are\" Lessing ("7ythen\"" cape enaractan \ We are learning “Python” prireesteay then w_ \nfor new line 4 = "string Ls collection of characters suroune wlth single ov deble or triste or single triple ar double triple qutes” rine) priretoeen) D> "string collection of characters surounée wlth single or dle or triple or nsingle tniple on dosble triple quotes rire) string Ss collection of characters surcunded with single or double or tole or single tne or double tote quotes Y. \tortab = "string Ls collection of characters suroune wlth Single ov deble or teinle or single triple ar double triple ques” rine) priretoeen) D> "string 1s collection of characters surounée wlth single or dle or triple or \esingle tviple on double triple quotes rire) string Ss collection of characters sucsunded with single or double or tote or single tele or cauble tape quotes v Path botht = "€2\0e@79\060312.25,paatypo8” prireqearn) \goecn3en 2225.0 otha = "e/seczez3/2025_12_25,pstatypes™ # Lax path priretparn) £/9eca23/2025 12.25 otatypes patht = "e:\\9oec2023\\2025_12_25staTypes” # windows path oriretpav) s\poecaza 2051225 oataTypes patht = r°E2\9oe2003\2029_12.3 oatatypes" # windows path praretpatm e\oecazs 2051225 oatarypes th = os. event) priretpat) s\onena23\2603_12_25.tatypee os.ntstate(peeny py etecepaint Ieanentae'] | 1) se Sndexing + @123°4.5 ( stares wlth @ fader, read fron Left to right) decult step shzee 2 2) "we Sndexing + -2-} “A'S (starts with 1 dex y road fran ight to 2eft ) default step size 2-1 = ue to access She eanacter from string seri) sen] seen an} stea{-t} cere seen stea[-28] cee rire (eye) clare ine brire(eypelad) Oeste) eines)

You might also like