Exercice 1
Ecrire un algorithme python pour afficher tous les éléments d'une liste donnée de deux manières différentes
Solution
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#coding: utf-8 # définir une liste python L = ["laptop" , "ipad" , "iphone" , "tablette" , "imprimante"] # première méthode print("\npremière méthode\n-------------") for x in L: print(x) # deuxième méthode print("\ndeuxième méthode\n-------------") n = len(L) for i in range(0, n): print(L[i]) |
Younes Derfoufi
CRMEF OUJDA
Acheter sur Très Facile !
-
Python pour le Data Scientist - 2e éd- Machine Learning
€ 29,00 Acheter le livre -
Wireless Souris Gamer Rechargeable 3200 - G-Lab-Xbox-Ps5-PC
€ 17,00 Acheter le produit -
Obtenez Microsoft 365 Famille avec Office 365 apps - 15 Mois + NORTON 360 Deluxe - PC/MAC, tablette et smartphone
€ 57,00 Acheter le produit
1 thought on “Solution Exercice 1: algorithme python qui affiche les éléments d'une liste”