Python Pattern Programs - Printing Numbers in Right Triangle Shape
Вставка
- Опубліковано 15 вер 2024
- In this Python Pattern Printing Programs video tutorial you will learn to print numbers in right triangle shape in detail.
To print numbers in right triangle shape in python you have to use two for loops. the first loop is responsible for rows and the second for loop is responsible for column.
For more free tutorials on computer programming
/ amulsacademy
/ amulsacademy
n=int(input("please input"))
list=[ ]
word=" "
for i in range(1,n+1):
list.append(str(i))
x=word.join(list)
print(x)
for j in range(1,n+1):
list1=[ ]
word1=" "
while len(list1) != j:
list1.append(str(j))
y = word1.join(list1)
print(y)
I am a beginner myself. Your video helped alot. Hope my piece homework is not too embarrasing. haha
Your voice is so different specially at python word.
I have been using Python 2 for a long time and I didn't know that print is a statement in Python 2...
Thank god I came across the video..🙏🙏
Thank you so much...❤️
Thanks Mam. Excellent and cool explanation. Always confused about the patterns,this video has made me clear. Keep posting.
Thank you :)
I want talk to you about program related please give me your email id or any contact
What my sir is not be able to do is done by you
Thanks a lot
This is a student just one day before final exam........
Please make more python programming examples videos. Great way of teaching
Thank you:)
Will do :)
first year CSE ?
Nobody did not teach like you in the youtube,madam super🙏
Thank you 😊
Best explanation never before never after
Thank you :)
The thing u just said ,its a floccinoccinihilipilification.......
Thank you for an interesting and fun program.
Welcome:)
Best explanation ever...
Hi Madam,
nice teaching
i am understanding properly
when will use this type of pattern program
Very good explanation it is easy to understand after your explanation. Now I know how to print the patterns Iam a beginners but I understand the logic to print the patterns thank you madam
her accent of saying those numbers at 6:58 was so satisfying lol
😂✋
your voice is awesome....ti gives me extraordinary inspiration to learn python programming and I love it💙
Thank you :)
Can u send me any advance python programs ?
Yes really I am just falling in love with
🤣🤣🤣🤣
I love the tutorial, thank you!
My xam starts on dec 4. Please make as soon as possible. I can get you more subscribers
Particularly which topics you want? so that we can cover that first:)
Best teacher for python programming
Thanks a lot.Take love from Bangladesh.
Pleasure 😊
Hi! Can you please make a video on the question: If a list in python has mix of strings & numbers, how will you make separate lists of strings & numbers? I saw ord() for getting ASCII code in python & chr() for converting ASCII codes to characters somewhere & tried to use them to get answer of this question but it did not work!! :(
Try this:
list1 = [1,2,"amul","x",4]
list2 = [i for i in list1 if str(i).isdigit()]
list3 = [i for i in list1 if str(i).isalpha()]
print(list2)
print(list3)
:)
What is the Syntex for the program to run ?
Thank you madam thankq so much your way of explanation is superb
Thank you :)
Mam can you pls tell how to do this programme using while within while
rng= int(input(" enter the range : "))
for j in range(1,rng+1):
print(str(j)*j)
nice one.
how to write 1111 then 2222 then 3333 .....etc
Very good explanation.. much easier to follow.. thanks a lot.
Glad it was helpful!
Hello mam apka explaination way to osm h hi
Apki voice kitni pyari hai
😅Bahot jyada hi cute lgti h apki avaj
Thank you :)
@@AmulsAcademy mam 😄plz facecam kriye naa ye bs meri ni aur v Learner's ki mang hai
Dear Amul's,
Can you pls make a video on permutations concept. seems to be not done yet.
sure:)
hi ;
u have mentioned first row as 1 plz just clear my ambiguity was it not be mentioned like index zero as u have written range(1,i+1)
Why it is not like (0,i+1).
and if we write zero what whould be the consequences.
When you are printing number pattern, i want to print number from 1 right.
1
12
123
1234
here first we want print number 1, that's why i took range from 1.
you can take 0, then it will start the pattern from 0
if you take range(0,i+1)
then it will print,
0
01
012
0123
like this .
If you want take range from 0 and if you want to print number from 1 then you can write program like this:
for i in range(0,5):
for j in range(0,i+1):
print(j+1,end="")
print()
:)
Nice explanation mam thank you so much
Most welcome 😊
Can you please make videos on interview questions and more videos on C programs
Will try 😊
mam plz can u provide the code using while loop..i am getting the first one but in reverse order and i cant find anywhere else using while loop.
Actually both pattern are same, for second pattern you need to print i value .
You can try by yourself.
If you need any guidance ask be back :)
@@AmulsAcademy no no mam..actually i was trying the pattern using while loop....but getting something weird...thats y i was asking for help using while loop
hello amulya, i have watched your star paterne video that's amazing but i have face a minor error in diamond paterne, you will first enter the number of rows by user suppose that entered number is 5 but in the paterne number of row is 9 that,s wrong if we will enter 5 that means the required rows is 5, please correct it........
Thank you, i will check that :)
very good way of explaining dear...Thanks
Thank you:)
Really the method of explaining is so much of absorbing all things going with the flow.....:) Can you please upload few more videos on building patterns of numbers like forming a square or pyramid by taking input of range of two numbers from a user and then printing the numbers within that range???!!!
Thank you:)
Soon i will upload more videos on patterns:)
tbh ur voice is so sweet :) ....some times i watch more videos only to listen to ur voice :)...um may i knw ur name?
Thank you so much:)
My name is Amulya.
Amuls Academy oh cool name :) looking for more good stuff from u learning more from ur channel than from my clg lol
But don't make spit sounds please. Have water b4 making videos.
Thank you.
Good explanation ...very usefull for new learner....
how would you do it backwards like instead of:
1
12
123
you would do:
1
21
321
Similar type of pattern:
ua-cam.com/video/vOH9_Ryl-hI/v-deo.html
rows = 3
for row in range(1, rows+1):
for column in range(row, 0, -1):
print(column, end=' ')
print(" ")
It is very much helpful thank you so much
Pleasure :)
I am trying to do the program on printing stars and numbers in diamond shape but able to get it.pl suggest something
Give me your program I will try :)
This is your recent program on amulyas academy
Very best class
Thank you :)
sister suppose we don't want to print a last line..i mean if n=6 it will display upto 5 what we want to do
You can change the range in for loop for row.
:)
@@AmulsAcademy thank you...soo much
Dont put mic so close to mouth
😂😂
🤣🤣🤣
😢😢😂😂😂😂
Ma'am will you upload a video on some important patterns (star and number) for class 10 as per CBSE guidelines
Maam what should v do if v want to print the same program but use alphabet?
You may get ideas after watching this video :)
ua-cam.com/video/5605NysRJCU/v-deo.html
it is giving error as invalid syntax...when i had copied the whole program u wrote on your interactive mode...the equals to sign in end="" is giving the error i dont know why...
I think you are using python 2 version.
This program will run in python 3 version.
for python 2:
n = input("number of rows:")
for i in range(1,n+1):
for j in range(1,i+1):
print i,
print
:)
Ur voice is very smooth,
I like it 😍😍😍😍
very nice! thank you very much
Glad you liked it!
if there should not be any space after the each element of the last column and no new line after the last row.what should i do?
you can put print() and space first.
for i in range(5):
print()
for j in range(i+1):
print(" ",i,end="")
:)
But why?
I didn't understand Ma'am
I didn^t understand second part. 7.13 .We said for x in i but we didn^t use x. When ı delete that line input is beinf 12345. what is the real reason we need this line? Could somone help?
To my consciousness,this is the best explanation for beginners.!
thankyou so much
great help
My Pleasure:)
Can we perform it by while loop?..
Yes :)
why have you taken range(1,i+1)....why not (1,n+1)? both the values are same...
Gud explanation I really inspired
Thank you so much :)
Ma'am,thank u so much!❤❤❤
Most welcome 😊
Ma'am , please clarify my doubt.. Which version of python you're using? Python 2 or 3???🥺
Can you write this logic in just one line without using strings?
Mam I'm following the same procedure but it's not working . All the nos are printed but each digits in a line .
1
1
2
1
2
3
.
........and so on .
Plz help me mam. I have check the code many times .I'm using python 3.7.3
You didn't use end=" ".
please check
:)
I love your "tri tri tri"❣️🙂 and i love the video too
it was helpful to me thank you!!
Pleasure :)
First Wale ka kya hum log will Loop se nhi baana sakte hai
Thank you friend, this was so god damn helpful!
Voice n teaching 😊😊
Thank you 😊
I have one doubt. This program. Ku one video. Post pannga mam.
N=5
for i in range (1,N+1):
for K in range (N,i,-1):
print (" ",end =' ')
for j in range(1,i+1):
print(j,end =' ')
for 1 in range (i-1,0,-1):
print (i,end =' ')
print()
Neenga intha example la oru video podunga mam sub:Python. (Unit -3) .topic name [printin the pattern ]. Mam this video understand. But i told you this example la oru video post pannga mam.
mam i am following the same procedure but its not working all the numbers are displayed in single line
I think you didn't use end=" ".
Check that.
Else give me your program:)
Please check the position of print ( )
Thank you
You're welcome :)
for new line instead of prin() can we include print(
)
but it is throwing error
"
"
very good
thanks
Thanks 😌
Welcome 😊
Thank you very much Amul, you helped me a lot! 🙂🙏
Glad to hear that :)
I'm unable to understand 'Nested loops' and how the Outer and Inner loops execute. Can you make a video on it or suggest any website or article which explains this in detail.
I will try :)
@@AmulsAcademy Please do would be really helpful and thank you for your content.
Hi !
Can you do a vedio to print an pattern of right angle triangle with numbers
With only one 'print' statement
I will try :)
Well explained..thank you
Welcome:)
Hello
thank u for teaching about python
Very nice
Thank you :)
nice explanation
Thank you :)
i am not getting answer in pattern, its displaying in one row
use print() in first for loop......{for loop for row}
:)
@@AmulsAcademy thax its work
You are fabulous 🔥🔥🔥🔥
Thank you :)
very good explanation
mam why we cant use simply range(n) in case of row
Here we want to print numbers starting for 1, that's why i took range() form 1 :)
@@AmulsAcademy thanks mam
You are a fabulous tutor. Can you please pass me the questions for class 11 for examination for CBSE board. Please assist me as computer is my weak subject :)
Thank you so much :)
Sorry i don't have question papers with me.
Amulya's Academy Any source from where I can access them? One more question, can you please compile all the CBSE programs and provide them on your channel:), or what you’ve uploaded covers the entire content?
Write a Python program that takes an integer input as height from the user
and then print the pattern. what will be the answer of this?
Nice
Thank you :)
Does anyone know which editor is she using ?
Thank You very much !!!
Pleasure :)
U are literally 👍🏻 super....
Thank you :)
which software you are using for coding please guide
how to print double right angled triangle using python for loop
*
* *
* * *
* * * *
*
* *
* * *
* * * *
hello! so I did the exact pattern you taught in the video-
n = int(input("Enter the number of rows"))
for i in range (1,n+1):
for j in range (1,i+1):
print(j, end="")
print ()
however, when ran module, it doesnt give me the simple pyramid pattern; it gives me this instead-
1
1
2
1
2
3
1
2
3
4
1
2
3
4
5
do you know how I can fix this? thank you!
hey so i think mine works copy paste it and try it basically its just the position that you placed the print function in the last line
n = int(input("Enter the number of rows"))
for i in range (1,n+1):
for j in range (1,i+1):
print(j, end=" ")
print ()
count = 1
for i in range(1,5):
for j in range(1,i+1):
count= count + 1
print()
.
.
.
Is this correct coding ma'am?
You are not printing anything :)
how can i build the list of pyramid with different numbers
@ 0:03 u said "Amul's academy" instead of "Amulya's academy"...just for fun
Yes previously channel name was amuls academy :)
@@AmulsAcademy oh ok Amul mam!🙂
Hi. Very useful. However, the i and j numbers are the index numbers of rows and columns right? I could not grasp j starting from 1 in the video for floyd's triangle. Then I realised j starts from 1 means it starts from col no.1 and goes till col no. (i) .am I right?
In this video some people might get confused I think between index number and actual content inside, since both start from 1 in each row. I saw another similar video from your channel only..that was when I understood the funda of index numbers. Thanks :)
sorry to be offtopic but does anyone know of a way to get back into an instagram account??
I was stupid lost my login password. I appreciate any tricks you can give me.
@Leonidas Levi Instablaster :)
@Ulises Vihaan I really appreciate your reply. I got to the site through google and I'm in the hacking process atm.
I see it takes quite some time so I will get back to you later when my account password hopefully is recovered.
@Ulises Vihaan DAMN IT ACTUALLY WORKED :O Literally got access to my ig password within ~ 45 mins by using the site.
I had to pay 15$ but definitely worth the price :O
Thanks so much, you saved my ass !
@Leonidas Levi glad I could help :)
How do we write the program to print 54321,5432,543,54 in triangle shape?
n= int(input("rows:"))
for i in range(n,0,-1):
k=n
for j in range(i,0,-1):
print(k,end=" ")
k=k-1
print()
:)
please make a video using while loop wiht the same concept
I will try :)
how much expertise should I have in python to get a job in Bangalore?pls, say in details with complete details for a data analyst job.
Please do upload more videos of pyramid and programmes logical
What if we want the output with only one print function
for i in range(1,n+1):
print(str(i)*i)
Try this 😊
mam how to print that pattern program using while loop
ua-cam.com/video/P2Gs2U2_sHI/v-deo.html
you can modify that code to get number pattern :)
Amuls Academy Thank u soo much
Thank you so much👍👍
My pleasure:)
You Can Solve It Without Two Functions By Using range
N = int(input())
X = range(0,N)
for i in X:
print(*range(1,i+2),sep="")
what this"*" doing in print function?plz explian.
for i in range(1,11):
for j in range(1,11):
k=i*j
print k,
print ''
can u please explain the logic of this code
It looks like multiplication table.
in the first row you are multiplying 1 with 1,2...........................10
second row you are multiplying 2 with 1,2...........................10
third row you are multiplying 3 with 1,2...........................10
if you multiply column and row it will print this pattern
:)
Thank you very much.
Thank u🙌🏻♥️