6 kyu

Hollow Triangle

231 of 402user3879542

Description:

Create a function that takes a positive integer n and returns a hollow triangle of the correct height.

The height n is passed through to the function and the function should return a list containing each line of the hollow triangle.

When n = 6,
Should return :
["_____#_____", 
 "____#_#____", 
 "___#___#___", 
 "__#_____#__", 
 "_#_______#_", 
 "###########"]
 
When n = 9,
Should return : 
["________#________",
 "_______#_#_______",
 "______#___#______",
 "_____#_____#_____",
 "____#_______#____",
 "___#_________#___",
 "__#___________#__",
 "_#_____________#_",
 "#################"]

The final idea is for the hollow triangle is to look like this if you decide to print each element of the list:

n = 6 will result in:
_____#_____              1
____#_#____              2
___#___#___              3
__#_____#__              4
_#_______#_              5
###########              6 ---- Final Height

n = 9 will result in:
________#________        1
_______#_#_______        2
______#___#______        3
_____#_____#_____        4      
____#_______#____        5
___#_________#___        6
__#___________#__        7
_#_____________#_        8
#################        9 ---- Final Height

Pad empty spaces with underscores (_) so each line is the same length.

Good luck and have fun coding!

ASCII Art
Fundamentals

Stats:

CreatedJul 10, 2016
PublishedJul 10, 2016
Warriors Trained653
Total Skips22
Total Code Submissions956
Total Times Completed402
Python Completions231
Ruby Completions42
JavaScript Completions156
Total Stars22
% of votes with a positive feedback rating94% of 124
Total "Very Satisfied" Votes110
Total "Somewhat Satisfied" Votes13
Total "Not Satisfied" Votes1
Total Rank Assessments18
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • user3879542 Avatar
  • GiacomoSorbi Avatar
  • user5036852 Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad