dimanche 19 juillet 2020

How to add the row of pattern problem to a list in python

a="5234"
for k in range(len(a)):
    for i in range(len(a)):
        for j in range(len(a)-i):
            print(a[j],end=" ")        
        print()
    a=a[1:]

And I got the output as:

5 2 3 4  
5 2 3   
5 2   
5   
2 3 4   
2 3   
2   
3 4   
3   
4  

Now I want to add each row in the above output to a list

Aucun commentaire:

Enregistrer un commentaire