mercredi 6 octobre 2021

Unable to print the following basic pattern

I want to print This pattern.

1 2 3 4

1 2 3

1 2

1

So I implement this

 x = int(input("Enter number of row:\n"))

 for i in range(1,x+1):

     for j in range(1,x+1):

         print(j,end=" ")

     print() 

but I don't get as showed in question I know that no. of column have to decreased by one but how ever I can not managed to do that. please tell me what I have to do in order to solve the question.

Aucun commentaire:

Enregistrer un commentaire