Computer Science, asked by dlalitkishore2, 2 months ago

Write a PYTHON program to print the given pattern. If the value is ‘C’ and the number of lines is 5 then the pattern should be printed in the following format :
C E G I K
D F H J
E G I
F H
G

Answers

Answered by sravya5198
1

Answer:

Python 3.x code to demonstrate star pattern

# Function to demonstrate printing pattern

def pypart(n):

# outer loop to handle number of rows

# n in this case

for i in range(0, n):

# inner loop to handle number of columns

# values changing acc. to outer loop

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

# printing stars

print("* ",end="")

# ending line after each row

print("\r")

# Driver Code

n = 5

pypart(n)

Similar questions