Posted by: Sourav | December 11, 2013

Triangle pattern using while loop in python 3


a=5

b=1

while a>=1:    

        while b<=a:        

              print (“*”,end=””)     

               b=b+1

    a=a-1  

   b=1   

  print (“”)   

  c=1

d=1

while c<=5:    

      while d<=c:      

         print(“*”,end=””)      

          d=d+1

    c=c+1   

  d=1    

print(“”)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: