Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1719 connectés 

  FORUM HardWare.fr
  Programmation
  Python

   L'alignement avec la fonction le format en python

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

L'alignement avec la fonction le format en python

n°2306079
ydv81
Posté le 27-09-2017 à 01:25:17  profilanswer
 

Bonjour  
 
J'aurai besoin de votre aide svp!
J'ai un problème d'alignement et d'espace  avec mon code , a chaque fois que j'ai met un nombre > a 9.
quand j'ai exécuté mon code en python il y a de débordement.
Le but de mon code se de s'ajuster a n'importe quel nombre que je veux saisir(ex:1,5,50,70,1000...)
 
Merci pour  
 
Voici mon code

Code :
  1. alignement = ' {:<9}{:^9}{:>9}'
  2. h ='*'
  3. f = '*'
  4. j ='*'
  5. taille = int(float(input('Entrez la taille :')))
  6. for d in range (0,taille+1,1):
  7.      print(alignement.format(h * d, f * d, d * j))

mood
Publicité
Posté le 27-09-2017 à 01:25:17  profilanswer
 

n°2306090
masklinn
í dag viðrar vel til loftárása
Posté le 27-09-2017 à 21:25:52  profilanswer
 

What?


---------------
Stick a parrot in a Call of Duty lobby, and you're gonna get a racist parrot. — Cody

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Python

   L'alignement avec la fonction le format en python

 

Sujets relatifs
question sur python triangle * couronneEvenement touche python no gui
fonction de répartition ?Appel fonction et paramètres variables
[Python] Barre d'outil[PRC]Ouvrir un fichier au format PRC?
[Python] Sous échantillon aléatoire pas vraiment aléatoire! Pourquoi ?Probleme fonction
Par quel langage remplacer du python?executer un script en python en variable?
Plus de sujets relatifs à : L'alignement avec la fonction le format en python


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR