π
<-
Chat plein-écran
[^]

Afficher les données dans un tableau - python graph 90 + e

Programmation et implémentation d'algorithmes.

Afficher les données dans un tableau - python graph 90 + e

Unread postby cyberespia » 08 Dec 2021, 21:21

Il existe un moyen d'afficher des données tabulées, c'est-à-dire dans un tableau.
J'ai testé ce code, mais il le montre horizontalement

Code: Select all
## Python program to print the data
d = {1: ["Python", 33.2, 'UP'],2: ["Java", 23.54, 'DOWN'],3: ["Ruby", 17.22, 'UP'],10: ["Lua", 10.55, 'DOWN'],5: ["Groovy", 9.22, 'DOWN'],6: ["C", 1.55, 'UP'] }
print ("{:<8} {:<15} {:<10} {:<10}".format('Pos','Lang','Percent','Change'))
for k, v in d.items():
  lang, perc, change = v
print ("{:<8} {:<15} {:<10} {:<10}".format(k, lang, perc, change))


Il existe un autre moyen ou bibliothèque d'utiliser et d'afficher des données dans des tableaux. si possible avec scroll
User avatar
cyberespia
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 40%
 
Posts: 5
Joined: 15 Oct 2021, 18:35
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: Afficher les données dans un tableau - python graph 90 +

Unread postby critor » 08 Dec 2021, 21:28

À un tout petit problème d'indentation près, ton code marche très bien et tu peux bien scroller une fois terminé :
Code: Select all
## Python program to print the data
d = {1: ["Python", 33.2, 'UP'],2: ["Java", 23.54, 'DOWN'],3: ["Ruby", 17.22, 'UP'],10: ["Lua", 10.55, 'DOWN'],5: ["Groovy", 9.22, 'DOWN'],6: ["C", 1.55, 'UP'] }
print ("{:<8} {:<15} {:<10} {:<10}".format('Pos','Lang','Percent','Change'))
for k, v in d.items():
  lang, perc, change = v
  print ("{:<8} {:<15} {:<10} {:<10}".format(k, lang, perc, change))

Image
Image
User avatar
critorAdmin
Niveau 19: CU (Créateur Universel)
Niveau 19: CU (Créateur Universel)
Level up: 42.7%
 
Posts: 41502
Images: 14751
Joined: 25 Oct 2008, 00:00
Location: Montpellier
Gender: Male
Calculator(s):
MyCalcs profile
YouTube: critor3000
Twitter: critor2000
GitHub: critor

Re: Afficher les données dans un tableau - python graph 90 +

Unread postby cyberespia » 08 Dec 2021, 21:34

Excellent merci. :yo:
User avatar
cyberespia
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 40%
 
Posts: 5
Joined: 15 Oct 2021, 18:35
Gender: Not specified
Calculator(s):
MyCalcs profile


Return to Programmation

Who is online

Users browsing this forum: No registered users and 56 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1750 utilisateurs:
>1735 invités
>10 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)