Python Pattern Programs - Floyd's Triangle | Printing Numbers in Right Triangle Shape

Поділитися
Вставка
  • Опубліковано 19 лип 2024
  • In this python pattern video tutorial you will learn how to print numbers in right triangle shape or floyd's triangle program in detail.
    Floyd's triangle is the right angle triangle of natural numbers. It contains consecutive numbers starting from 1 at left corner.It is named after Robert Floyd.
    Here we are using nested for loop that is for loop within the for loop and logical or operator. In this tutorial we explained how can we write floyd's triangle program in python 3 as well as python 2 in detail.
    For more free tutorials on computer programming
    / amulsacademy
    / amulsacademy

КОМЕНТАРІ • 213

  • @justDo7
    @justDo7 4 роки тому +4

    Tysm ..i use every of these patterns to built my logic.. and its work..
    Tq.

  • @lucasbuch8839
    @lucasbuch8839 2 роки тому

    Very good explanation! Thank you!

  • @yiwenhuang1707
    @yiwenhuang1707 Рік тому

    this is very useful! i used it for to make a multiplication table.

  • @sairamadaboina8257
    @sairamadaboina8257 Рік тому +2

    Thank you, Your explanation was in a detail way, please upload more and more videos.

  • @DheerajPrakaash
    @DheerajPrakaash 6 років тому +3

    If the input for the number of rows is >=5 &

    • @AmulsAcademy
      @AmulsAcademy  6 років тому +1

      Yes while printing number pattern we will face problems:)
      Thank you for sharing info:)
      We can also use format() to solve that.
      You can Check out:
      ua-cam.com/video/L19e53kEciI/v-deo.html
      :)

    • @DheerajPrakaash
      @DheerajPrakaash 6 років тому +1

      Amuls Academy, yes. Thanks!

  • @alexandrehobbescoelhocosta7072
    @alexandrehobbescoelhocosta7072 3 роки тому +1

    Thank U so much for the video!! U explain very well!!

  • @santoshreddy8363
    @santoshreddy8363 5 років тому +1

    from one week on wards i am following u r videos

  • @sachinshukla2227
    @sachinshukla2227 2 роки тому

    This is really very nice, thank you amulya

  • @shadowsradar7978
    @shadowsradar7978 Рік тому

    thankyou veryy muchh...this was the only thing i was searching for...well explained

  • @macwingodson7117
    @macwingodson7117 3 роки тому +2

    Thank you so much.. by you only I can submit my assignment

  • @noahhcams
    @noahhcams 2 роки тому +1

    I had this problem in a job interview and couldn't figure it out :/ Thanks for the video!

  • @uzair3206
    @uzair3206 4 роки тому +1

    really appreciate it. its really helpful, keep it up.

  • @omsrisaikrishna9618
    @omsrisaikrishna9618 5 років тому +7

    Can you show me debugging (i:e)
    Each and every line, how it will be excute.....??

  • @manims1271
    @manims1271 3 роки тому +8

    Magical Voice 🤞

  • @user-pu7uk7us3e
    @user-pu7uk7us3e 6 років тому +1

    thank you ma'am for your explanation

  • @abhishekr3688
    @abhishekr3688 3 роки тому +1

    Perfect Explanation, please do more on DSA concepts

    • @AmulsAcademy
      @AmulsAcademy  3 роки тому

      Thank you 😊

    • @abhishekr3688
      @abhishekr3688 3 роки тому

      @@AmulsAcademy can you do more videos on DSA concepts ( Python ) ?

  • @tadipiraju9197
    @tadipiraju9197 2 роки тому

    Excellent,,, especially your voice is amazing 😍

  • @nishanthkarkera7864
    @nishanthkarkera7864 Рік тому

    ur way of explanation is sweet as ur voice...than kew❤

  • @sarthakaggarwal8082
    @sarthakaggarwal8082 4 роки тому +6

    This can be done in this way too :
    for n in range(0,5):
    for j in range((n**2 - n + 2)//2,(n**2 + n + 2)//2):
    print(j,end=" ")
    print()

    • @JSON-eo4kz
      @JSON-eo4kz 4 роки тому +1

      I think u r good at math......
      Can u please tell me how you derived that math expression?

    • @3BoxCreation
      @3BoxCreation 4 роки тому +1

      oh.. great... beautiful equation

    • @sarthakaggarwal8082
      @sarthakaggarwal8082 3 роки тому +1

      @Mohan Prasath Thanks

    • @sarthakaggarwal8082
      @sarthakaggarwal8082 3 роки тому +1

      @@3BoxCreation Thanks

    • @sarthakaggarwal8082
      @sarthakaggarwal8082 3 роки тому +1

      @Vinay kumar I am actually preparing for jee. From there I know making general term.

  • @vaishnavisharma5080
    @vaishnavisharma5080 5 років тому

    Thnkuu....u r the best

  • @vishaldipke950
    @vishaldipke950 2 роки тому

    Thank you bro .... Keep going 🤗☺️😊

  • @sumitkumarsain5542
    @sumitkumarsain5542 5 років тому

    I am in love with the trainer. What a knowledgeable trainer

  • @princechauhan4885
    @princechauhan4885 5 років тому +1

    Thank you for the video

  • @SubhenduPanja
    @SubhenduPanja 4 роки тому

    Hi.. I have a request please give me a solution.
    Here instead of entering rows user will input any number and that will print in this order.. Thank you. 🙂🙂

  • @Raja-tt4ll
    @Raja-tt4ll 4 роки тому +1

    Nice Tutorial Thanks :)

  • @anshulpandit740
    @anshulpandit740 5 років тому +1

    Osm bro u clear all my doubts

  • @ajayrajdharajiya2688
    @ajayrajdharajiya2688 3 роки тому +1

    Lots of thanks for easily explain thanks 😊😊

  • @rishikasharma6546
    @rishikasharma6546 2 роки тому +2

    This code may solve the problem of the alignment of 2 digit numbers in the pattern shown in this video
    n=20
    for i in range(1,n+1):
    for j in range(1,i+1):
    print(j,end=" ")
    print()

  • @faltu1.0
    @faltu1.0 5 років тому +2

    Welcome to python programming :)
    Uff!!!! How adorably tell it!

  • @utoobbott8817
    @utoobbott8817 2 роки тому

    excellent explanation

  • @saivikas7032
    @saivikas7032 3 роки тому +2

    Mam,after printing 1st row the for loop for col interrupts. so when we print row 2 so the output should get as 12 naa.
    How we are getting output in row 2 as 23

    • @AmulsAcademy
      @AmulsAcademy  3 роки тому

      We are taking separate variable to print numbers and we are incrementing that after printing value so we will get continuous numbers :)

  • @swaruppanda2842
    @swaruppanda2842 5 років тому +1

    what if the input value for n to be written without double codes will it still consider it as string or will take otherwise.

    • @AmulsAcademy
      @AmulsAcademy  5 років тому

      In python 3, input() takes input as string.
      if you mention 3, this is the integer value right, but it will treat that as string.
      :)

  • @KK7155.
    @KK7155. 3 роки тому +1

    I fall in love of your voice😍😍😍

  • @krishnansukumar3279
    @krishnansukumar3279 5 років тому +4

    Thanks a lot for clearly explaining about iterations and rows and columns. Just subscribed.
    But I have a doubt. I coded without user input. I added my own range (1,6) for i, and then (1,i+1) for j. Everything else is same as your code.
    Now, when count=1 I am getting the output starting from 2. When count=0 I'm getting the proper output starting from 1.
    Can you explain why?

    • @AmulsAcademy
      @AmulsAcademy  5 років тому +2

      Hi,
      This code will work properly, check your code with this,
      count =1
      for i in range(1,6):
      for j in range(1,i+1):
      print(format(count,"

  • @swayampal4234
    @swayampal4234 4 роки тому

    thank you so muchhhhhh

  • @jothi7066
    @jothi7066 6 років тому +1

    Good job..thank u

  • @nitindwivedi765
    @nitindwivedi765 5 років тому +1

    Well explain

  • @goginenirajasekhar9730
    @goginenirajasekhar9730 6 років тому +1

    Good Explanation

  • @MENataRajKumar
    @MENataRajKumar 2 роки тому

    Awesome 👍

  • @uzi5998
    @uzi5998 2 роки тому

    I've a loop which do a task and prints a line everytime it completes the loop and I want to print numbers too everytime what can I do ?

  • @chinnipanga6099
    @chinnipanga6099 Рік тому

    Thank you

  • @SP-cw4iz
    @SP-cw4iz 3 роки тому +1

    Thank you 🙏🏻

  • @satvikchaturvedi8596
    @satvikchaturvedi8596 5 років тому +2

    Can you please tell me how you could print the floyd's triangle in upside down shape?

    • @AmulsAcademy
      @AmulsAcademy  5 років тому +6

      Try this:
      num= int(input("enter the number of rows:"))
      n = int(num*(num+1)/2)
      for i in range(num,0,-1):
      for j in range(i):
      print(format(n,"

  • @harishwarreddy6244
    @harishwarreddy6244 5 років тому +1

    Can you please explain that when you use more than 2 for loops how can position my print code with respect to for loop I want to print?? I because some Time I don't understand to write my print function exactly under which for loop

  • @nicwalsh9537
    @nicwalsh9537 6 років тому +2

    Very good tutorial. However, if we wanted to make this a pyramid instead of a right triangle. How would I go about adding in the needed space to form the pyramid?

    • @AmulsAcademy
      @AmulsAcademy  6 років тому +4

      You need to write the for loop to print space:)
      num=int(input("enter the number of rows:"))
      n=1
      for i in range(num):
      for j in range(num-i-1):
      print(end=" ")
      for j in range(i+1):
      print(n,end=" ")
      n=n+1
      print()
      :)

    • @Diddin817
      @Diddin817 6 років тому +1

      Amuls Academy this left me with a pyramid that starts at 5 and is way longer than 5 rows if my input is 5. Not only that but when it gets to double and triple digits, it is not centered correctly. What could fix this issue?

    • @AmulsAcademy
      @AmulsAcademy  6 років тому

      To solve that 2 digit issue,
      num=int(input("enter the number of rows:"))
      n=1
      for i in range(num):
      for j in range(num-i-1):
      print(" ", end=" ")
      for j in range(i+1):
      if n>10:
      print(" ",n,end="")
      else:
      print(" ",n,end=" ")
      n=n+1
      print()
      :)

    • @Diddin817
      @Diddin817 6 років тому +1

      Amuls Academy as the digits continue to increase to 3 and 4, how will I make sure it all centers correctly

    • @AmulsAcademy
      @AmulsAcademy  6 років тому +2

      You can use format() for that:)
      Just an example:)
      print(format(num,"

  • @durveshmahajan8097
    @durveshmahajan8097 2 роки тому

    Thank you Mam🙏

  • @353sarathrejeti7
    @353sarathrejeti7 2 роки тому

    is the program same when we use alphabets instead of numbers ?

  • @pankajnagar143
    @pankajnagar143 5 років тому +1

    You are Doing "great job"

  • @sumitsaroha4460
    @sumitsaroha4460 2 роки тому

    Can u pls help to generate a code for two right triangles side by side?
    Left right triangle_right right triangle

  • @AbulkalamAzad-if2si
    @AbulkalamAzad-if2si 4 роки тому

    Can you give me the answer that in which row 2020 stays ??

  • @sudhakarpatekar8674
    @sudhakarpatekar8674 3 роки тому +1

    Mam how to print pattern in range for ex i want from 1 to 12 then what will be changes will take place in program

    • @AmulsAcademy
      @AmulsAcademy  3 роки тому

      I didn’t get you, give me input and output :)

  • @mahdivatankhah5425
    @mahdivatankhah5425 2 роки тому

    very good
    🌹🌹

  • @akp_321
    @akp_321 4 місяці тому

    You have cutest voice❤❤❤

  • @arpitmallick2403
    @arpitmallick2403 3 роки тому +1

    Best python video

  • @deepakadhiraaijog7387
    @deepakadhiraaijog7387 2 роки тому

    Good video, but u did not explain how the loop will stop at number 10. Can you please explain that part in the reply ?

  • @anupsubedi2622
    @anupsubedi2622 4 роки тому +1

    I love you saying, "that's nothing but.. :)"

  • @reynaldavrilliant1813
    @reynaldavrilliant1813 4 роки тому

    what if i want to make this pattern with some words ( strings )?? please help me

    • @uzi5998
      @uzi5998 2 роки тому

      Did you find any solution

  • @nalinipotturi3250
    @nalinipotturi3250 2 роки тому

    Pls help me how to solve this question"given an integer N as starting number and K as input write a programe reprint a number pyramid of k .

  • @anbukishore5936
    @anbukishore5936 2 роки тому

    What we do ,if input will be 10 and want the same output......?

  • @JSON-eo4kz
    @JSON-eo4kz 4 роки тому +1

    Good morning....Amul mam...
    Is it possible to print this sequence ,so that every column maintains the same indentation??(especially for 2 digit numbers)
    I mean like this.....
    1
    2 3
    4 5 6
    7 8 9 10
    11 12 13 14 15

    • @AmulsAcademy
      @AmulsAcademy  4 роки тому

      You can use format()
      Video link:
      ua-cam.com/video/L19e53kEciI/v-deo.html
      :)

    • @JSON-eo4kz
      @JSON-eo4kz 4 роки тому

      @@AmulsAcademy thank u mam....

  • @evgenkupa2831
    @evgenkupa2831 3 роки тому +2

    Genius!))

  • @syedazharmohiuddin3007
    @syedazharmohiuddin3007 Рік тому +2

    I'm getting error in line print=(num,end=" ") 😢😢

  • @doppalapudismily865
    @doppalapudismily865 5 років тому +6

    1
    2 3
    6 5 4
    7 8 9 10 how this pattern takes place mam please explain

  • @Krishnaveni-rf6pp
    @Krishnaveni-rf6pp 2 роки тому +1

    Hai.. Thank you very much for your explanation... But, i have a doubt.. That is when we use the version 2,how can we mention for space in output??

  • @sikandersingh6684
    @sikandersingh6684 4 роки тому +1

    Verry good

  • @StatusKing-xp2xu
    @StatusKing-xp2xu 4 роки тому

    n=int(input("Enter the end value number:"))
    k=1
    for i in range(1,n+1):
    for j in range(1,i):
    if k

  • @andrinrafealla8763
    @andrinrafealla8763 4 роки тому +2

    Mam, after 9, I want to start from 1 instead of 10... can u help

  • @chetanyag6991
    @chetanyag6991 4 роки тому +1

    Hell medam,
    Using 3.8.0 latest paython
    I am not getting exact output
    Any changes in paython 3.5 and 3.8

    • @AmulsAcademy
      @AmulsAcademy  4 роки тому

      I think No :)Give me the program i will check :)

  • @kB_VUTUKURIJOHNHOSANNANBKRIST
    @kB_VUTUKURIJOHNHOSANNANBKRIST 2 роки тому

    Where you're from akka,exclent explenation.

  • @soulfulman4834
    @soulfulman4834 4 роки тому

    Show me this program using concatenation property...

  • @urnakundu3157
    @urnakundu3157 3 роки тому +1

    I tried your program with number of rows as 6 and 10 but it did not give me the exact output

    • @AmulsAcademy
      @AmulsAcademy  3 роки тому

      Give me the program,I will check :)

  • @BKYADAV-zm7yv
    @BKYADAV-zm7yv 4 роки тому +1

    Thanks mam

  • @kbsuthar4716
    @kbsuthar4716 5 років тому

    Hello Ma'am, How can i write code for this que
    Que. Following program copies the contents of source file to a destination file.
    More precisely, the code is making copy of the source file problem-1.py
    # Modify the following program to copy only the code elements and skip
    all the comments. Comments in python start with character '#'

  • @sarthakkalsotra9989
    @sarthakkalsotra9989 4 роки тому

    can anyone tell how to reverse this triangle

  • @naveenkumarnaidu5278
    @naveenkumarnaidu5278 3 роки тому +1

    Can you say how to draw the flowchart for this.

  • @parthshah9275
    @parthshah9275 3 роки тому +1

    Can you please explain how to get single digit and double digit in a single line?

    • @AmulsAcademy
      @AmulsAcademy  3 роки тому

      You can format the output using format function 😊

    • @parthshah9275
      @parthshah9275 3 роки тому

      @@AmulsAcademy yup I understood after watching the NEXT video Thankyou

  • @jaanu256
    @jaanu256 Рік тому

    Why we are taking range from 1 why not from 0 and why are taking n+1 and not n wat is the difference

  • @sciencewithshriya
    @sciencewithshriya 3 роки тому

    Is there a way to find the sum of the numbers in the very last row of the triangle?

    • @soph4582
      @soph4582 3 роки тому

      if you used a list to create the triangle you could cut the list at a certain point then find the sum of the numbers after that in the list

    • @sciencewithshriya
      @sciencewithshriya 3 роки тому

      @@soph4582 thank you...but how can you do that?

  • @shoaibahmed2506
    @shoaibahmed2506 5 років тому +1

    how to print lower triangle matrix in python 3

    • @AmulsAcademy
      @AmulsAcademy  5 років тому

      Number pattern or star pattern?
      Give me the pattern:)

  • @vaviletivamsi
    @vaviletivamsi Рік тому

    Same code with two input please explain

  • @sruthir1236
    @sruthir1236 3 роки тому +1

    Thq

  • @Itz_bondyt
    @Itz_bondyt 3 місяці тому

    Very Well Explained you earned a Sub. Thanks a lot Dear

  • @balabhaskar7120
    @balabhaskar7120 3 роки тому +1

    can u help me in coding the same in reverse order like shown below
    10
    9 8
    7 6 5
    4 3 2 1

  • @komalpoddar5072
    @komalpoddar5072 4 роки тому

    How to print alphabet in triangular shape

  • @santoshreddy8363
    @santoshreddy8363 5 років тому +1

    mam how can i contact u

    • @AmulsAcademy
      @AmulsAcademy  5 років тому

      You can ask your queries here, or in our fb page :)

  • @sachinshukla2227
    @sachinshukla2227 2 роки тому

    And you are from Benglore

  • @C-C-ud7jz
    @C-C-ud7jz 4 роки тому +1

    Ma'am i'm getting as 1
    1
    22
    333
    4444
    55555 etc same code i typed

    • @AmulsAcademy
      @AmulsAcademy  4 роки тому

      you are printing i value {or row value } that's why you are getting this output :)
      You need to take another variable and store value 1 in that and you need to print that variable in the print()
      :)

  • @vastavlegend4654
    @vastavlegend4654 3 роки тому

    I Love You

  • @vpvignesh7810
    @vpvignesh7810 4 роки тому

    write a program using number as limit instead of number of rows...

  • @narendraak2524
    @narendraak2524 2 роки тому

    I entered correct
    But output is syntax error

  • @udayanagavenkatakranthibha255
    @udayanagavenkatakranthibha255 3 роки тому +1

    Super voice

  • @naveenkanike8367
    @naveenkanike8367 2 роки тому

    2 triangular pattern code example

  • @ashutoshsharma929
    @ashutoshsharma929 2 роки тому

    hi
    can u make a program in python which output is
    1
    2 3
    3 4 5
    6 7 8 9
    9 10 11 12

  • @ashulohar8948
    @ashulohar8948 Рік тому

    Rhombus pattern?

  • @kbsuthar4716
    @kbsuthar4716 5 років тому +2

    Mam how can i write this code,
    1
    2 3
    3 4 5
    4 5 6 7
    plz suggest me code

    • @AmulsAcademy
      @AmulsAcademy  5 років тому +1

      n = int(input("enter the number of rows:"))
      num =1
      for i in range(n):
      for j in range(i+1):
      print(num,end=" ")
      num=num+1
      num =num-i
      print()
      :)

    • @rajdavande
      @rajdavande 5 років тому +1

      s=int (1)
      for r in range (0,10):
      for c in range (0,r+1):
      if s>10:
      print ((s),(""),end='')
      else:
      print ((s),(" "),end='')
      s=s+1

      print ()

    • @Sapna6215
      @Sapna6215 5 років тому +1

      Both the replies are not working with 3.5.1 try below one:
      n = int(input("Enter the number of rows:"))
      for i in range(1, n + 1):
      for j in range(1, i + 1):
      print(i,end=" ")
      i = i + 1
      print()

  • @sksahadatali4410
    @sksahadatali4410 5 років тому

    I did not get it..plz make it simple

  • @shivkumarvangari8605
    @shivkumarvangari8605 4 роки тому +2

    1
    3 2
    6 5 4
    10 9 8 7 how to do it..?

    • @lordshiv9290
      @lordshiv9290 3 роки тому

      have you got solution?

    • @manasamuchchatti5653
      @manasamuchchatti5653 3 роки тому

      code:
      start = 1
      stop = 2
      currentNumber = stop
      for row in range(2, 6):
      for col in range(start, stop):
      currentNumber -= 1
      print(currentNumber, end=' ')
      print('
      ')
      start = stop
      stop += row
      currentNumber = stop

  • @dchandrakimothi5470
    @dchandrakimothi5470 4 роки тому

    N= yan

  • @hancaxiu3076
    @hancaxiu3076 4 роки тому +1

    How to code this?
    1 2 3
    4 5
    6

    • @AmulsAcademy
      @AmulsAcademy  4 роки тому +1

      n = int(input("rows:"))
      k=1
      for i in range(n,0,-1):
      for j in range(n-i,0,-1):
      print(format(" ","

    • @hancaxiu3076
      @hancaxiu3076 4 роки тому

      Thank you so much! 😭
      Enter Multiplier: 3
      1 2 3
      2 4 6
      3 6 9

  • @mnist1317
    @mnist1317 4 роки тому

    Why is my math teacher making me locate 9999 in the triangle, what the hell ????