Printing Stars "*" in Pyramid Shape | Triangle | Python Pattern Program
HTML-код
- Опубликовано: 5 сен 2024
- In this python programs video tutorial you will learn to print stars in pyramid shape in detail.
We used Nested for loops to write this program.
Printing Stars in Right Triangle Shape (mirror image)
• Printing Stars "*" in ...
Printing Stars in Right Triangle Shape:
• Printing Stars "*" in ...
Printing Stars in Inverted Right Triangle Shape
• Printing Stars "*" in ...
#PythonPrograms #PatternProgram
You can Checkout:
ProgramsAndMe
programsandme
Here is the updated version :
n=int(input("Enter the number of rows:"))
for i in range(1, n + 1):
print(" " * (n - i), end=" ")
print("*" * (2 * i - 1))
Make it more simple........
very well explained! saw so many videos but this was the easiest to understand :)
Explained in a very simple way. Thanks👍
Most welcome 😊
excellent explanation, not only for this questions but also help me to do other printing star pattern questions
n = 5
i = 1
while i
Wah bete mauj kardi.
This is really an excellent channel on Python like "techie talkee"
Thank you :)
loved it ! thank u for teaching us !
Thnks mam what a wonderful and simple explanation ❤
Wow th way of explaining pyramid star very nice
Excellent explanation of logic the best channel for learning about patterns
This is the short code that I have never seen in another videos and websites
Thanks for everything mam😌😌👌
Most welcome :)
Great explanation with a beautiful voice.Thanks
Simple explanation
Very helpful tutorial
thank you 😊
Ty bro, was about to give up ❤
Very Good explanation sister 😊
this was more good than our teacher
is it compulsory to take j can we use other alphabets
Yes you can :)
Thank you mam.. This is the best video i got ❤
Usefull
thanks a lot
Awesome Video and Good Explanation
Thanks
Amazingly Explained thanks
Nice explanation
You got one more subscriber 😊 Thanks very helpful
You are the best ❤
what an awesome explanation
Wow
Thanks ❤ dear
Welcome :)
Thank you!
good explanation madam
What a nice explanation!!!
thankyou all doubt clear
Hats off super mam
your voice is very nice
like your videos and voice tooo👍❣
apka dhanyawaad
Thank you.
Excellent I understood please help in fubunocci
bro thanks very good video
Loved your explanation..
Hello newbie here maam. it show the full pyramid and the right.. what about the left? Thank u
See, the code in the video is unnecesarily long
n = int(input("No. of rows required: "))
for i in range(1,n+1):
m = n-i
print("-"*m, end="")
print("x "*i)
Try this
Which platform is she using here?
Is it possible to print an isosceles triangle?
Give me the pattern :)
this is an iscosceles already bro
Thnx mam
i developed a very simple code for this
n=int(input("no of rows required: "))
m=n-2
for i in range(1,n):
print(' '*m,end='')
print('x '*i)
m=m-1
it prints 1 layer less
its incorect
1) The Space is not printed properly( It only prints 2 spaces per row
2) One layer less
Fixed Code:
n = int(input("No. of rows required: "))
for i in range(1,n+1):
m = n-i
print("-"*m, end="")
print("x "*i)
Sol 1)It should be m - i as for 5 rows the first row needs 4 spaces and thus, in the range 1,6(1,n+1) starting value of i will be 1
hence m-i(1) = 4
this fixes the space problem
Sol 2) The range must be n+1 as the value of the range is start,end+1 hence if rows inputed is 5, for 5 rows a value of 1,6( n + 1)
Atleast you tried and most importantly, it works. Just one row lesser.
Good explanation 😁
Thank you 😊
U voice is like amulya academy only
This is Amulya academy second RUclips channel only
why do indians say 'only' after every sentence
this madea prarralelogram for me?
x= int(input("please enter the amount of rows you would like: "))
for i in range(x):
for j in range(x-i-1):
print(" ",end="")
for k in range(x+1):
print("#",end=" ")
print()
👍👍👍👍
Thanks madam 😊
Can we do it without input command?
It is possible but then yuuou can only get the pyramid for aa fixed value, ie cannot be inputed by the user
U voice match with amulya academy girl?
Yeah.. because this is my another channel 😊
@@programsandme7593 congrats ❤️🎉
U are too good in programing 🔥
@@programsandme7593 😂
@@bdof6528 🗿
😂😂😂
Please explain hollow pymarid
# Generating Hollow Pyramid Pattern Using Stars
row = int(input('Enter number of rows required: '))
for i in range(row):
for j in range(row-i):
print(' ', end='') # printing space required and staying in same line
for j in range(2*i+1):
if j==0 or j==2*i or i==row-1:
print('*',end='')
else:
print(' ', end='')
print() # printing new line
i have an doubt
Not proper o/p ...
It's coming EOFerror:
Give me the program, I will check 😊
Ur amulya academi right
goat
Hi Amulya ji
ur voice ❤️❤️❤️❤️❤️❤️
l=[]
for i in range(1,9,2):
l.append('*'*i)
for j in range(0,len(l)):
b=len(l[-1])-len(l[j])
c=int(b/2)
l[j]=" "*c+l[j]+" "*c
for p in l:
print(p)
Mera issi code se kuch or hi print kr rhaa h
South Indian
Bro its an not yan
😂😂😂
yennnnnnnnnnnnnnnnnnnnnn
Jab koi jyada English bolta hai
To mera dil karta hai...
English me video bana rahe ho
Or mujhe kuch ghanta samajh nahi aara
n is pronounced as yen XD
Good explanation
Thank you!
Great
Thank you :]