Nested Loop Triangle

Victor Demelo badbarefoot at gmail.com
Thu May 25 12:36:47 EDT 2017


I need the triangle to be in reverse. The assignment requires a nested loop to generate a triangle with the user input of how many lines. 

Currently, I get answers such as: (A)
OOOO 
OOO 
OO 
O 

When I actually need it to be like this: (B)
OOOO 
  OOO 
   OO 
    O 



I need the display (A) to just be in revered, so I need it starting from the right side and go left, and not the left side going right with the '0' stacking on top one another.


#Code
base_size = int(input("How many lines? ")) 
columns = base_size 
  
for row in range (base_size) : 
   for columns in range (columns) : 
       print('O', end='') 
   print()  



More information about the Python-list mailing list