Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Theme 9(bis)

655 views

Published on

  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Theme 9(bis)

  1. 1. Theme 9Approfondir les structures de données (Listes, tuples et dictionnaires)<br />2011-04-07<br />1<br />
  2. 2. Les listes: Accès aux éléments<br />nombres=[5,38,10,25]<br />Accéder à un seul élément (index)<br />Ex: print(nombres[2])<br />10 <br />Accéder à plusieurs éléments (slicing: découpage en tranches)<br />Ex: print(nombres[1:3])<br />[38, 10] #tranche de type liste<br />Ex: print(nombres[2:3])<br />[10]<br />Ex: print(nombres[2:])<br />[10,25]<br />Ex: print(nombres[-1])<br />25<br />Ex: print(nombres[-3])<br />38<br />2<br />
  3. 3. nombres = [17, 38, 10, 25, 72]<br />Trier une liste<br />Ex: nombres.sort()<br />Inverser l’ordre des éléments<br />Ex: nombres.reverse()<br />Retrouver l'index d'un élément (le premier rencontré)<br />Ex: nombres.index(17)<br />Enlever un élément (le premier rencontré)<br />Ex: nombres.remove(38)<br />Enlever un élément à un index<br />Ex: del(nombres[2])<br />Ex: del(nombres[2:4])<br />3<br />Les listes: autres opérations<br />
  4. 4. Les listes: Remplacement d’éléments<br />mots = ['jambon', 'fromage', 'confiture', 'chocolat']<br />Insertion dans une liste<br />Ex: mots[2:2] = ['miel']<br />Ex: mots[5:5] =['saucisson', 'ketchup']<br />Suppression de la liste<br />Ex: mots[2:2] = ['miel']<br />Ex: mots[2:5]=[]<br />Ex: mots[1:3] = ['salade']<br />4<br />
  5. 5. Exercice 9.1<br />Écrire un programme qui permet de simuler une gestion de la file d’attente suivante dans un centre de services<br />['client 1','client 2','client 3','client 4','client 5','client 6','client 7'] <br />Sans utiliser un compteur de boucles<br />Le premier client arrivé dans le centre de services est 'client 1‘<br />Le résultat de la simulation serait<br />['client 1'] est en cours de service, il reste les clients suivants dans la liste ['client 2','client 3','client 4','client 5','client 6','client 7'] dans la file<br />['client 1'] servi<br />['client 2'] est en cours de service, il reste les clients suivants dans la liste ['client 3','client 4','client 5','client 6','client 7'] dans la file<br />['client 2'] servi<br />Etc..<br />5<br />
  6. 6. Exercice 9.2<br />Écrire un programme qui permet de comparer deux listes<br />Par exemple comparer deux à deux les listes suivantes<br />liste1=[76,23,14,2,33,18]<br />liste2=[23,76,33,18,2,14]<br />liste3=[2,56,85,12,1,1]<br />Pour cela nous utiliserons la fonction sort()<br />6<br />
  7. 7. Les listes et la fonction range<br />La fonction range fournit un ensemble de nombres (objet particulier appelé itérateur)<br />range( [départ,]arrivée[,pas])<br />Nous pouvons construire une liste à partir de cet ensemble avec list()<br />Ex: list(range(2,10))<br />Nous pouvons aussi construire un tupleà partir de cet ensemble avec tuple()<br />Ex: tuple(range(4,25,6))<br />7<br />
  8. 8. Les tuples<br />Types de données composites: chaînes, listes + tuples<br />Chaines Vs listes<br />Composition: caractères Vs différents types<br />Non modifiables Vs modifiables<br />Tuple<br />Composition: différents types<br />Non modifiable<br />Syntaxe<br />Ex: monTuple=('anne','cote',24,'etudiante')<br />8<br />
  9. 9. Similaires aux opérations sur les listes, sauf opérations de modification(ajout et suppression)<br />Longeur d’un tuple: len(monTuple)<br />Accès à un élément<br />monTuple[3]<br />monTuple[1:] (le slicing retourne un tuple)<br />Conversion en liste<br />Liste = list(monTuple)<br />9<br />Les tuples: les opérations<br />
  10. 10. Exercice 9.3<br />Écrire un programme qui permet de charger des villes ainsi que leurs coordonnées (latitude, longitude) enregistrées dans un fichier «villes.txt ». <br />Pour que ces informations ne soient pas modifiées tout au long du programme, nous désirons les inscrire dans des tuples. <br />Les différents tuples seront enregistrés dans une liste définie dans le programme<br />10<br />
  11. 11. Surcharge de l’opérateur +<br />Applicable aux chaines, listes et tuples<br />Opérateur + (concaténation):<br />uneChaine = "aaabbb ccc " <br />uneChaine = " --- "+uneChaine+ " --- "<br />liste = liste + ['jambon', 'fromage', 'confiture']<br />liste1 = liste + [‘recette']<br />montuple = tuple1+tuple2<br />montuple=tuple6+montuple+tuple3<br />11<br />
  12. 12. Surcharge de l’opérateur *<br />Applicable aux chaines, listes et tuples<br />uneChaine = "aaabbb cccc " *3<br />uneChaine = unechaine+" "+unechaine*3<br />liste = liste*3<br />liste1 = liste +[‘recette']<br />montuple= (tuple6*montuple+tuple3)*2<br />12<br />
  13. 13. Les dictionnaires<br />Type composite<br />Chaînes, listes et tuples: séquences ordonnées (les éléments sont indexés par des séquences d’entiers)<br />Dictionnaire:<br />Opérations: La plupart est similaire avec celles des listes<br />Différence: Les éléments sont indexés par clés uniques<br />Une clé: alphabétique, numérique, ou type composite(sous certaines conditions)<br />Les éléments peuvent être de n’importe quel type de donnée<br />13<br />
  14. 14. Création d’un dictionnaire<br />Initialisation directe<br />Initialisation par ajout élément par élément<br />14<br />dico = {'computer': 'ordinateur', 'keyboard': 'clavier', 'mouse': 'souris'}<br />printdico["computer"]<br />dico = {} #intialisationd’un dictionnaire<br /> <br />dico["a"]=["arbre","alien","abrit"]<br />dico["b"]=["betise","batiment"]<br />dico["c"]=["cat","cale","cailloux"] <br /> <br />printdico<br />print dico["a"]<br />print dico["a"][2]<br />
  15. 15. Opérations sur les dictionnaires<br />Enlever un élément<br />Exemple: deldico["a"]<br />Test d’appartenance d’une clé<br />print  "b" in dico<br />if "b" in dico:<br />print "Trouvé!"<br />Liste des clés du dictionnaire<br />printdico.keys()<br />Liste des valeurs du dictionnaire<br />printdico.values()<br />15<br />
  16. 16. Parcours d’un dictionnaire<br />Itérer sur les clés<br />for uneClein dico:<br />printuneCle,dico[uneCle]<br />Lister les couples (clé, valeur) du dicitonnaire sous forme de liste de tuples<br />liste = dico.items()<br />print liste<br />Parcourir les tuples de clés et leurs éléments associés<br />for uneCle, uneValeurin dico.items():<br />printuneCle,uneValeur<br />16<br />
  17. 17. Remarques<br />Les dictionnaires ne sont pas des séquences (les indexes n’ont pas d’ordre déterminé)<br />Erreur si on essaye de <br />Concaténer<br />Extraction d’éléments contigus (slicing)<br />Possibilité d’affecter un indice (la clé) contrairement aux listes<br />17<br />
  18. 18. Exercice 9.4<br />Nous désirons représenter la matrice suivante à l’aide d’un dictionnaire:<br />18<br />
  19. 19. Solution<br />A chaque couple (ligne, colonne) correspond un élément<br />Représenter le couple par un tuple<br />Indexer l’élément par le couple (ligne, colonne) correspondant<br />dico[(0,2)]=["roi"]<br />dico[(1,0)]=["pion"]<br />dico[(3,1)]=["reine"]<br />dico[(4,0)]=["tour"]<br />dico[(5,2)]=["chevalier"]<br />Tester <br />printdico[(5,5)] !!!<br />19<br />
  20. 20. Solution au probleme de clé non définie<br />Traiter le cas des clés inexistantes dans le dictionnaire: fonction get()<br />Exemple: printechiquier.get((5,5), "non existant")<br />20<br />clé<br />Message a afficher dans le cas ou la clé n’existe pas<br />
  21. 21. Exercice 9.5<br />Écrivez une fonction qui échange les clés et les valeurs d’un dictionnaire (ce qui permettra par exemple de transformer un dictionnaire anglais/français en un dictionnaire français/anglais). <br />On suppose que le dictionnaire ne contient pas plusieurs valeurs identiques.<br />21<br />
  22. 22. Exercice 9.6<br />Écrivez un script qui crée un mini-système de base de données fonctionnant a l’aide d’un dictionnaire, dans lequel vous mémoriserez les noms d’une série de copains, leur âge et leur taille. <br />Votre script devra comporter deux fonctions : la première pour le remplissage du dictionnaire, et la seconde pour sa consultation<br />Dans la fonction de remplissage, utilisez une boucle pour accepter les données entrées par l’utilisateur. Dans le dictionnaire, le nom de l’élève servira de clé d’accès, et les valeurs seront constituées de tuples(âge, taille).<br />La fonction de consultation comportera elle aussi une boucle, dans laquelle l’utilisateur pourra fournir un nom quelconque pour obtenir en retour le couple ≪ âge, taille ≫ correspondant. <br />22<br />

×