Python number pattern problem

i have to source code of this number pattern programme

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

and the second programme

1
2 3
3 4 5
4 5 6 7
5 6 7 8 9

plzzz help

Seriously?
Here you go.

# First Program
print(1)
print(2, 3)
print(3, 4, 5)
print(4, 5, 6, 7)
print(5, 6, 7, 8, 9)

# Second Program
print(5, 4, 3, 2, 1)
print(4, 3, 2, 1)
print(3, 2, 1)
print(2, 1)
print(1)
2 Likes

thnku bt in this programme using condition s

1 Like

Seriously? That’s how you coded the solution for this pattern in your school? :rofl:

And so seriously? How are people not able to solve such simple patterns

Majority of the people are still struggling to learn programming in college years. Can’t really blame them…

Pattern 1:

n=5
for i in range(n,0,-1):
	for j in range(i,0,-1):
		print(j,end=' ')
	print()

Pattern 2:

n=5
for i in range(1,n+1):
	k=i
	for j in range(1,i+1):
		print(k,end=' ')
		k=k+1
	print()
2 Likes

Here you go :relieved:

# First program
n = int(input())
for i in range(n):
    print(*([j for j in range(i+1, 2 * (i+1))]))

# Second Program

n = int(input())
for i in range(n):
    print(*([j+1 for j in range(n - i)][::-1]))