L'alignement avec la fonction le format en python

L'alignement avec la fonction le format en python - Python - Programmation

Marsh Posté le 27-09-2017 à 01:25:17    

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))

Reply

Marsh Posté le 27-09-2017 à 01:25:17   

Reply

Marsh Posté le 27-09-2017 à 21:25:52    

What?


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed