Created
January 14, 2018 19:21
-
-
Save skydevht/3eba647ba961cd46e0c70d5ed71f5573 to your computer and use it in GitHub Desktop.
Defi mwa janvye an: A pati de yon list chif "1234567890", repwodwi pye bwa sa jan li ye a (Yon pye bwa ki fèt ak lèt nan lis chif la)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Python 3 | |
ch = input('Chiffre: ') #ch ap stoke chif yo sou fòm chèn | |
n = len(ch) # n ap itilize valè sa ki se konbye chif | |
for i in range(n): # n ap gen pou afiche n liyn | |
pad = ' ' * (n - (i + 1)) # sa se pou kalkile e stoke fòs espas nou ap bezwen | |
a = ch[0: i+1] # nou pran chif n ap bezwen yo selman | |
b = list(a[1: len(a)]) # nou retire premye a e stoke res la sou fom tablo | |
b.reverse() # nou vire yo lanvè | |
b = ''.join(b) # nou konvèti tablo a an chèn | |
s = pad + b + a # nou kole tout ansanm | |
print(s) # nou afiche liy nan | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment