Python Pyramid Pattern Programs - Star Pattern

preview_player
Показать описание
Python Pyramid Pattern Programs - Star Pattern
In this video we will see the beauty of Python, printing patterns in single loop.

You can also write the below code for the above star pyramid pattern.

n=int(input("Enter The Number Of Rows: "))
for i in range(1,n+1):
print((n-i)*" "+" ".join(i*"*"))

The join() is a string method which returns a string concated with the element of an iterables(such as list,string and tuple).
Рекомендации по теме
Комментарии
Автор

sir 2 for loop wala method mujhe zyada easy laga jisme if condition v aata hai

adarshsonar
Автор

And even I try this also it's not printing spaces.

For I in range (5):
For j in range(5-i-1):
print (" ", end=" ")
For j in range(I+1):
Print("*", end=" ")
Print ()

Output/
*
*
*
***
**
****

shiva
Автор

Sir it's not printing spaces initially like 3 2 1plz resolve my issue I am stuck here my output is like below



Output/

*
* *
* * *
* * * *

shiva