06 - PATTERN PROGRAMS IN PYTHON PROGRAMMING

preview_player
Показать описание
PATTERN PROGRAMS IN PYTHON PROGRAMMING
PATTERN - 1
*
* *
* * *
* * * *
* * * * *
PATTERN - 2

* * * * *
* * * *
* * *
* *
*
Рекомендации по теме
Комментарии
Автор

for pattern 1
n = int(input("Enter number of rows: "))
for i in range(1, n+1):
print(' '*(n-i), end='')
print('* '*i, end='')
print()
we can do the same thing with single for loop also sir.

kandisrikanth
Автор

#Code for both the patterns
print('enter no of rows')
rows=int(input())
print("1st pattern is ")
for t in range(1, rows+1):
g=rows-1
for k in range(g):
print(' ', end='')
for h in range(t):
print('*', end='')
print()
rows-=1
print('enter no of rows')
rows=int(input())
print("2nd pattern is ")
for j in range(rows, 0, -1):
m=j

s=rows-j
for q in range(s):
print(" ", end='')
for k in range(m):
print('*', end='')
print()

tuhinsaha
Автор

for i in range(1, 6):
for j in range(6, i, -1):
print(' ', end='')
print(i*"*")
Simple

shreyaskulkarni
Автор

sir explain iterations in detail ....how this range(5, i, -1)works ...i am not getting how range method works

poojakonda
Автор

Sir can you explain this pattern programs sir
* *
* *
*
* *
* *
Please sir can you explain this type of patterns ask three mnc companys interview questions

lovelySam