Computer Science, asked by janvikaur766, 4 months ago

Write python code to draw following pattern:

4

3 4

2 3 4

1 2 3 4​

Answers

Answered by anindyaadhikari13
8

Question:

Write a python code to display the following pattern.

4

3 4

2 3 4

1 2 3 4

Program:

This is an easy question. Read this post to get your answer.

Here is the program.

# Python code to display the following pattern

# Written by @mr_anindya_adhikari

# 4

# 3 4

# 2 3 4

# 1 2 3 4

# Take number of rows as input.

n = int(input("Enter the number of rows: "))

# Display the pattern.

print("Here is your pattern..")

for i in range(n,0,-1):

for j in range(i,n+1):

print(j,end=" ")

print()

print("Program Finished.")

Take the number of rows as input and display the pattern.

Output is attached.

Attachments:
Answered by BrainlyProgrammer
3

Question:-

Python Code to display

4

3 4

2 3 4

1 2 3 4

_________

Code:-

for i in range(4,0,-1):

for j in range(i,4+1,1):

print(j,end=" ")

print()

#Written by @swetank232894

_________

Variable description:-

i--->loop variable

j--->loop variable

•Output attached

Attachments:
Similar questions