Partial preview of the text
Download Easiest explanation for python and more Summaries Computer science in PDF only on Docsity!
- <"programmer’ cht ="programmer” oe ch2 €"en" h2 ='en" + + — la Soncaténation de deux ou plusieurs chaines} ch3 <"PYTHON' es HON" les caractéres. ch €chtach2uch3 Hale ch contient “programmerenPYTHON" long (ch) Jen (ch) —_| Retourne la longueur de la chaine ch L € long (ch) ] L= len (ch) Lcontient 18 pos(ch4,ch2) | chafing (era) | Retoume la premizre postion de a chaine cht dans fa| P< P98 (1 ch) p=chfind ("7) chaine ch2 et reniourne -1 si elle n’existe pas, pcontient 1 d<€11231 d=11231 conveh (d) str (d) Retourne la conversion d'un nombre d en une chaine de| ch € convch @) ch = str (d) caractéres. ch contient "11231" x © valeur (ch) x = int (ch) 7 tient 11231 tient 11231 int (ch) Retourne la conversion d'une chaine ch en une valeur| ~ a valeur (ch) float (ch) numérique sinon elle provoqueune erreur. ch €"100.25" ch ©"100.25" x € valeur (ch) X € float (ch) xcontient 100,25 x contient 100.25 x €estnum ("100°") x ="{00" isclecimal() estnum (ch) ch.isdecimal () | Retourne vrai si la chaine ch est convertible en une] x contient vrai x contient True valeur numérique, elle retourne faux sinon. x estnum ("225") x="a25", isclecimal () xcontient Faux x contient false Retourne une partie de la chaine ch a partir de lal cht € sous_chaine(Programmer en python”, 0,10) | ch1=eh[0:4 0] ou cht=chf:10] soa daniel chia'f] position d jusquata position f-1 ( f est non incluse). chi contient “Programmer” Retourne une partie de la chaine ch 4 partir de la}ch1 € effacer (‘Programmer en python’, 10,13) cht=chf 14] + ch{13 :] effacer (ch, d,f) — |ch=ch[:d] + chif:]| position d jusqu’ala position f-1 (fest non incluse). ch1 contient "Programmer python" chi € majus ("python") [eht ="python* upper() hy i juscules. majus (ch) ch.upper(), | Retourne la chaine ch enmajuscu ok ee