Exercices corrigée en langage Python -- python 3.7 sous Windows 7, Windows8, Windows 10-- Nous allons voir dans cet exercice, comment créer un programme Python qui demande à l'utilisateur de taper un texte sous forme d'une chain de caractères et de lui renvoyer tous les mots du texte qui commencent avec la lettre a.
Nous utilisons dans cet exercice python la méthode split pour convertir une chaine de caractères python en une liste python.
La méthode de chaîne Python split () renvoie une liste de tous les mots de la chaîne, en utilisant str comme séparateur (se divise sur tous les espaces si elle n'est pas spécifiée), limitant éventuellement le nombre de fractionnements à num.
Nous utilisons aussi la boucle for pour parcourir les éléments de la liste crée via la méthode split et la structure conditionnelle if pour tester si le mot rencontré est une chaine de caractères python qui commence par la lettre 'a'
Pour un bon visionage de la vidéo, utilisez google chrome.
Corrected exercises in Python language - python 3.7 under Windows 7, Windows 8, Windows 10 - We will see in this exercise, how to create a Python program which asks the user to type a text in the form of a chain of characters and to return to it all the words of the text that begin with the letter a.
In this python exercise, we use the split method to convert a python string to a python list.
The Python split () string method returns a list of all words in the string, using str as the separator (splits on all spaces if not specified), optionally limiting the number of splits to num.
We also use the for loop to iterate over the elements of the list created via the split method and the conditional structure if to test if the word encountered is a python string that starts with the letter 'a'
For a good viewing of the video, use google chrome.