Python Pattern Program - Number Pattern (Printing Numbers in Pyramid Shape)
Вставка
- Опубліковано 13 жов 2024
- In this Python Pattern Programming video tutorial you will learn How to print numbers in pyramid shape in detail.
To print numbers in pyramid shape we will use nested for loops.
For more free tutorials on computer programming
/ amulsacademy
/ amulsacademy
Personally I am from Ukraine and i have been looking for such a cool and skillful teacher like you for so long time. And finally i succeed. You can explain such uneasy and sometimes challenging things in a really good and easy to understand way so that I am just being amazed at your skills of teaching. With love from Ukr! The English Language is a great force. I am only 15 years old and I reckon everything is ahead!
Thank you so much :)
Best teacher !!! Thanks a lot Mam.
I tried solving this by myself , without watching your video. Hope it will help someone.
rows =8
for i in range(1,rows):
for j in range(rows-i,-1,-1):
print(end=" ")
for j in range(i,0,-1):
print(j, end="")
for j in range(2,i+1,):
print(j, end="")
print()
❤️😊
@@AmulsAcademy Just a request , in your upcoming videos please explain time complexity as well, while explaining algorithms.
This is outstanding channel, to build the logic from scratch!! Amulyaji aap ka voice, teaching style awesome, it wont distract when u are teaching. Love it it!!
Thank you so much 😀
U r voice is too good to listen
And u r explaining perfectly
I want some more patterns like this☺️☺️
you really made a hard work to make users understand in a simple way but i had to concentrate a lot to understand as your voice distracted me a lot..........your voice is god gift......
Can u please upload some harder patterns? It would be a great help.
And thanks for this one...it really helped a lot
Ok :)
@@AmulsAcademy your program was wrong (check with 10 or above value , you wont get pyramid) you can observe at 11:14 last line of output pattern was wrong
@@shesharajupallysaikumar904 that is double digit 10
Mam your teaching is awesome.. I really love your teaching.. Mam I want python program for "pascal's triangle" will you please mam..
Ur explanation is crystal clear 👍
Thank you :)
Great.Well explained for beginners.Thanks a lot for sharing knowledge.
Thank you :)
Your voice is lovely ❤️ and so easily you teach them all in a simple way with easy and understanding English language for new comers 🙏plz you always make this type of coding vedios we learn to you a different and good kind of logics , methods, 🙏jai shree ram 🙏, keep going on
Thank you 😊❤️
simp
Thank You for supporting us madam,,,
Absolutely ur good teacher in python
Thank you :)
Thank You for supporting !
Pleasure 😊
Can you explain how one can code to print Binomial Distribution or Pascal's Triangle, like 1, 11, 121, 1331, etc? Thank you.
In love with ur voice amulya.. plzz like me
Hi, I started learning python... Too good lesson... Really thanks to U..
Thank you :)
Simply you’re a genius
Thank you :)
Are 4 loops required?
n = int(input("Enter the number: "))
L = [x for x in range(1, n+1)]
for i in range(1, n+1):
a = list(map(str, L[0:i]))
s = " ".join(a[1:][::-1] + a)
print(s.center((4*n)-3, " "))
Tank you so much madam. Your video help to learn Python easily
Glad to hear that :)
Great video! How could I do the inverse? I mean, add or score 1 in the middle instead of substracting. I am trying but I can't.
Really very good and awesome explanation
Thank you :)
You explain very well mam 😊
Thank you 😊
Nice.. Easy to understand... Thankyou amuls
Thanks Mam
Respect from Pakistan
Thank you:)
Explanation is simply superb Ms.Amulya :-)
Great job👨💻👨💻👨💻
Thank you so much 😀
Very very good voice for aur learning Python ..am realy attract.
Awesome! Please, keep posting with new programming solutions. Thank you...:)
Thank you :)
Yes i will keep posting videos on new topics.
Keep learning
:)
Very nice
Madam👍👍👍👍
Thank you :)
hi mam . i understand when u teach but feel difficult to do myself . how to improve my programming knowledge .
practicing
Good programmer. Pls explain how to copy data from online with python xml....
Mam output is coming in different shape
Your voice is inspiring a lot
Thank you :)
can you please make a program for letter "C"
Thank you Ma'am
Pleasure :)
Nice explanation mam...
instead of writing end=" "we can just put a comma also. Thanks a lot by the way
In Python 2
In python2.
U r saying 3
Can we done this simply by comma??
Ri8
Great and thanks
Excellent madam it is very much interested madam tq sooooooooo much
Madam thank you for the pattern program. But I think in all the print statements inside the for loops we need space. Otherwise pattern does not come as exact as shown in the beginning. Thank you very much.
yes you can use space or you can use format() for space management
:)
Amuls Academy
Thank you very much. How to generate Armstrong numbers. I know their are these numbers which are Armstrong but I am not able to generate it.. 153,370,371, and 407.
wow no words for your explanation!!!!!!
Thank you:)
Mam which one do u use to compile
Which application Ur using to run python
Very nice explanation thank you 😊
Most welcome 😊
nicely explained.good job.
@amul acedamy Hi could u explain how range (I, 0,-1)
Works
if i take range(5,0,-1) it will take value as 5 4 3 2 1
:)
What would be the program if v wanted to print the same triangle shape but instead of numbers v wanted "*"?
in print function print star :)
awesome explaination
Glad you liked it :)
Hi I have a doubt.. How to find Fibonacci number. Please can you send me code?
Video link:
ua-cam.com/video/wN45AChk9U4/v-deo.html
:)
@@AmulsAcademy thanQ
Your videos are really good. Thanks for sharing with us.
My pleasure:)
Thank you for this video. It helped me understand every iteration
ua-cam.com/play/PLFMdA1UJVR4bm0o8vTa9dcOS3_HNSP-fa.html
thank you so much mam explained great!
Most welcome 😊
Easy to understand python .this video more help.pls upload php lesson video.
thanks, ,you re a good teacher
Thank you! 😃
When I execute same program in my laptop I won't getting actual output some what am getting what's wrong?
Give me the program please, i will check :)
Can we reduced the numbers of code line
Yes you can :)
Voiceeeeeee😍😍😍😍
Pls give me suggestions how print in C program....to print value range
Learning is so good
hello amuls very good code, congratulations on the channel
Thank you :)
Mam what's your python version, I can't run it correct
Python 3
@@AmulsAcademy thank you
very well explained !! thanks a lot!!!
Thank you:)
Thank you so much Mam
why did u add '0' in for loop(i,0,-1)? what is zero used for?
0 is the end value ,
range() syntax is range(start, end, step).
for i in range(5,0,-1) it will give output as 5 4 3 2 1 , here 0 is end value which is excluded in range().
thank you! makes sense!
Mam I am getting wrong patterns yyyy??
When we give range(5,0) it prints in reverse order then y should we give the step as -1. Crt me if i am wrong..plz
if you don't put 0 there it will not show 1 in that pattern
Thank You Very Much For Such A Great Explanation : )
You are welcome! :}
such a simple explanation. keep it up
Thank you :)
how can i build the list of pyramid with different numbers
what is the difference between a while loop and for loop
While loop will execute block of code until a certain condition is met.
For loop is used to iterate over elements of a sequence. It will executes block of code "n" times.
:)
While loop is used if iterations or unknown and for is used if the iterations are known
When we give range(5,0) it prints in reverse order then y should we give the step as -1. Help me with this problem..plz
by default step value is +1.
when you mention range(0,5) by default it will take step value as 1 and we will get 0,1,2,3,4.
But in range(5,0) starting value is 1 and ending is 0 and you didn't mentioned step so it will take default value that is +1, so it won't print anything.
[You are telling to print values from 5 to 0 , and difference between second value and first value {step} to be +1 , it can't be possible.]
so you should mention step as -1.
range(5,0,-1): 5 4 3 2 1
difference between second value{4} and first value{5} is -1.
:)
Why are you not uploading any video?
Nice voice
.....
Please make a program video on pascal triangle
Thanks a lot
Please make a program for palindrome number.... in python it is as asking frequently in many interviews
ua-cam.com/play/PLFMdA1UJVR4bm0o8vTa9dcOS3_HNSP-fa.html
@Amuls Academy your program was wrong (check with 10 or above value , you wont get pyramid) you can observe at @11:14 last line of output pattern was wrong
Program is not wrong , Because 10 and above has 2 digits output looks like that.
You can format the output using format() and you can get proper shape.
:)
@@AmulsAcademy thanks for reply plzz share the code using format() in comments
Thanks a lottt
Pleasure :)
can you tell that the code for * pattern
Thanks a lot!!!🥰
THANK U !!!!!!!!!!!!!!!!!!
Welcome :)
dear mam. i have problem here i cant shape the triangle do somebody has the same issue?
Can you share your program here i will check :)
@@AmulsAcademy nvm i rechecked and its all fine thank u
Swaraj Shimpi you didn't declare the po function
Very useful one
Thank you :)
hello mam... i find it difficult tht how do u make concepts in different pattern. i find it really tough.... plz help
You can write the program in different ways but you need to understand the logic first:)
I love your brain ;)
Mam, pls post Pascal triangle program
ok:)
can we do the came with alphabet
Yes :)
Thanks mam and small bought
Thank you mam for your brief explanation
i want to use it opposite of it .like an arrow but its not working just help
I tried this:
num=9
for i in range (1,num+1):
for j in range (1,i):
print (end=".")
for j in range (num-i+1,1,-1):
print (j, end="")
for j in range(1,num-i+2):
print (j, end="")
print()
@@janso8463 num=9
for i in range (1,num+1):
for j in range (1,i):
print (end=" ")
for j in range (num-i+1,1,-1):
print (j, end="")
for j in range(1,num-i+2):
print (j, end="")
print()
you just learn c-corner website you copy the c corner website code
hi mam can you help me to print
1
2 3
4 5 6
and going on
l=[1,2,3,4,5]
for i in range(len(l)):
print(l[i::-1]+(l[1:i+1]))
more efficient logic
yes maybe but for amateur fiorst starter this logic is more logic than your experienced one
Actually, we can print the Pyramid with just one for loop
Yes we can :)
@Anirvan Sen j=9 #variable used for denoting spaces
n=int(input("enter how many rows of stars you want to print:"))
for i in range(1,n,2):
print(' '*j+i*'*')
j=j-1
@@ArunRajpidige I have seen that video too.
Please solve again full
Best👍👍👍
Thank you :)
Why you will not take 0th row
Because here i am printing value 1 in the first row, so i took range from 1.
:)
how can i reverse the pattern upside down
this is better:
c=int(input('please enter the number for this kind of structure'))
for i in range(1,c+1,1):
print(" "*(c-i) , end="")
for j in range(1,2*i):
if j
Wrong out put
try this: (you can optimize this code)
num =int(input("Enter number of rows"))
for i in range(num):
for j in range((num+num)-1):
if(j=num-(i+1) and j
if you take input as 100 then it is inefficient method as you see when you've given 10 it take some time.This is inefficient method
what is the code for 4th part
4th part is last space right?, No need to print that
:)
@@AmulsAcademy ya I know that,but I tried to print * in that space.thats y I asked uand I got it
ur voice is so sweet
Thank you:)
Brilliant
Thank you :)