Informatique

Question

Ecrire un programme Python qui demande un nombre nul(n) et qui imprime un triangle de nombre illuté comme-ci:
1
11
111

1 Réponse

  • Réponse :

    Bonjour,

    Explications :

    def triangle_un(p):

    ...return ([ str(1)*i for i in range(1,p+1) ])

    a=5

    tr=triangle_un(a)

    for i in range(len(tr)):

    ...print (tr[i])

Autres questions