'Why do the middle rows of my hollow right triangle all have the same size?
I have a task to create a hollow right triangle using a function. The question I have is how to print in numerical order.
So, starting with one in row one and ending in the last row with four characters. The code I have right now created the first and last rows. For the middle row I need it to have it in order but missing the middle if its greater than 2. I have a function that works and does this (hollow_row) but right now my code is just printing the given number without going from smallest to largest.
How can I fix this?
def triangle(char,n):
middle_row = hollow_row(char,n)
print(char*1)
for i in range (n-2):
print(middle_row)
print(char*n)
What it prints:
#
# #
# #
####
What it needs to print:
#
##
# #
####
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
