'''Triangle generator''' 

totalRows = int(raw_input ("Please enter a number: ")) 

stars = totalRows
for currentCol in range(1, currentRow+1): 
    for currentRow in range(1, totalRows+1): 
    
        print '*',
    print
print

for currentRow in range (1, totalRows+1): 
    for currentCol in range(1, currentRow+1): 
    
        print '* ' * stars 
        stars -= 1

Current output:

* 
* * 
* * * 
* * * * 

* * * * 
* * * 
* * 
*

I would like to know if there is a way to reflect the output triangles so that they print like this?

* 
    * * 
  * * * 
* * * * 

* * * * 
  * * * 
    * * 
      *

Is it something to do with spacing?

Start from this:

>>> for count in range(5):
	print ' '*(5-count) + count* '*'

	
     
    *
   **
  ***
 ****
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.