#stars.py #triangles of stars #User enters a number, output lines of one, two, ... that number of asterisks rows = eval(input("Enter size of triangle of stars: ")) for row in range(1,rows+1): #each row for col in range(1,row+1): #each column (i.e. star) on this row print("*", end="") #suppress the newline print() #newline for this line of output #"reversed" lines. Need to output some spaces before the stars print() for row in range(1,rows+1): #each row for col in range(1,rows+1): #each column on this row is either space or * if col <= rows-row: print(" ", end="") #space else: print("*", end="") # * print() #newline for this line of output