Code:
triangle_char = input('Enter a character:\n')
triangle_height = int(input('Enter triangle height:\n'))
print('')
for i in range(triangle_height):
updatedChar = ' '.join([triangle_char]*i)
print(triangle_char + ' ' + updatedChar + ' ')
i += 1
The output is correct but I can't seem to get rid of the extra " " whitespace at the end of the first iteration.
Example Output:
% # How to remove this whitespace but keep the others
% %
% % %