Skip to content

Instantly share code, notes, and snippets.

@skydevht
Created January 14, 2018 19:21
Show Gist options
  • Save skydevht/3eba647ba961cd46e0c70d5ed71f5573 to your computer and use it in GitHub Desktop.
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)
#!/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