Sunday 13 July 2014

Floyd's Triangle

Floyd's Triangle :

1
2  3
4  5  6
7  8  9  10
..
and so on ..


Python 2.7 code to print Floyd Triangle :



  1. # Floyd's triangle
  2. # https://beginer2cs.blogspot.com
  3. if __name__=='__main__'#check for namespace
  4.     row = int(raw_input('Enter Number of row of floyd triangeyou wanna print : '))
  5.     x=1 #initiate from x=1
  6.    
  7.     for i in range(1,row+1):  #this will create floyd triange
  8.         st=''    
  9.         for j in range(i):
  10.             st=st+' '+str(x)
  11.             x +=1
  12.         print st


OUTPUT :
Floyd triangle in Python

2 comments:

  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Data Science with Python , kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on TECHNOLOGY. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Sangita Mohanty
    MaxMunus
    E-mail: sangita@maxmunus.com
    Skype id: training_maxmunus
    Ph:(0) 9738075708 / 080 - 41103383
    http://www.maxmunus.com/

    ReplyDelete
  2. Find the best business loan provider in World! Here at Capital Funds Investment Ltd, you're able to get a business loan immediately with lowest inters.Email: (loancfifundsltd@gmail.com) whats-app/Call us now (91) 892 950 9036.

    Address:-

    Licensed Money Lender

    License No: 14/2017

    Business Reg. Number: 53119127C

    91 Ubi Crescent

    #03-03, India 408559

    Phone: (91) 892 950 9036

    Email : loancfifundsltd@gmail.com

    ReplyDelete

THANKS FOR UR GREAT COMMENT

Blogger Widgets