0

noob question. I need to add a space after I print the triangle char.

triangle_char = input('Enter a character:\n')
triangle_height = int(input('Enter triangle height:\n'))

i = 0
while i <= triangle_height:
   print(triangle_char * i )
   i += 1

eddward87
  • 1
  • 2
  • `print(triangle_char * i , end=" ")` – mhhabib Mar 25 '21 at 03:06
  • use either end=" " as `print(triangle_char * i , end=" ")` or use string formatting as `print("{triangle_char * i} ")` – ThePyGuy Mar 25 '21 at 03:09
  • Okay, so what happened when you put `python how to add a space after printing an input` [into a search engine](https://duckduckgo.com/?q=python+how+to+add+a+space+after+printing+an+input)? What happened when you tried [reading the documentation for `print`](https://docs.python.org/3/library/functions.html#print)? How about when you tried following along with the official Python tutorial, specifically the [part about input and output](https://docs.python.org/3/tutorial/inputoutput.html)? Stack Overflow is not intended to replace existing tutorials and documentation. – Karl Knechtel Mar 25 '21 at 03:12

0 Answers0