Home /
Expert Answers /
Computer Science /
define-a-function-triangle-which-takes-a-single-parameter-a-positive-integer-and-which-prints-a-pa975
(Solved): Define a function triangle which takes a single parameter (a positive integer), and which prints a ...
Define a function triangle which takes a single parameter (a positive integer), and which prints a triangular pattern of asterisks, having that number of rows, as in the example shown below. Partial credit may be given for code producing other triangular patterns of asterisks. Note that if the value of variable \( s \) is a string, then the expression " \( s * 4 \) " produces a string comprising 4 copies of s, e.g. so if s equals \( ' \star ' \), then "s \( \star 4 \) " generates the string \( ' \star \star \star \star ' \).