Exercice 87
Etant donné une list L, écrire un algorithme en python permettant de convertir une liste en une chaine de caractère sans utiliser aucune méthode prédefinie autre que la méthode str().
Exemple si
|
1 |
L = ["Python" , "created on", 91 , "by Guido Van Rosam"] |
, l'algorithme renvoie la chaine s = "Python created on 91 by Guido Van Rosam".
Solution
|
1 2 3 4 5 6 7 8 9 |
# coding: utf-8 L = ["Python" , "created on", 91 , "by Guido Van Rosam"] # initialisation de la chaine s s = "" for word in L: s = s + str(word) + " " print (s) # output: 'Python created on 91 by Guido Van Rosam' |
Younes Derfoufi
CRMEF OUJDA
![[App intégrée] 2025 Upgraded Vidéoprojecteur 1920 * 1080P FHD 4K Mini Projecteur Portable Dual Contrôle avec Souris Android TV WiFi 6 BT5.2 180° Rotation Compatible avec HDMI/TV Stick/USB](https://www.tresfacile.net/wp-content/uploads/2025/12/Videoprojecteur-1920-1080P-FHD-4K-Mini-Projecteur-Portable-Dual-Control-250x236.png)

