vendredi 30 novembre 2018

python loop, Pyramid pattern

can anyone help me with this code. It must be done using for and if only. 0 1 0 1 2 1 0 1 2 3 2 1 0 1 2 3 4 3 2 1 0 1 2 3 4

I tired and think every stuff but I dont understand what i am missing. I am having a issue with generating 101, 21012, 3210123, 43211234

here is my code(which is wrong) for i in range (1,6): for t in range (i,5): print('\t', end="") for j in range (0,(2*i-1)): print(2*i-1-j, "\t", end="") print("")enter image description here

Aucun commentaire:

Enregistrer un commentaire