![]() |
Python
1.0
|
Print the right triangle with the length of two of its sides equal to a given value \(n\), using the symbols + and =, in each of its four possible orientations. More...
Functions | |
def | rightTriangle (n, orientation=0) |
Return a string representing the right triangle of height n in a given orientation. More... | |
def | getAllTriangles (n) |
Generates and interleaves all four orientations for printing. More... | |
Print the right triangle with the length of two of its sides equal to a given value \(n\), using the symbols + and =, in each of its four possible orientations.
For instance, if n=5, the output should be:
+==== +++++ ====+ +++++ ++=== ++++= ===++ =++++ +++== +++== ==+++ ==+++ ++++= ++=== =++++ ===++ +++++ +==== +++++ ====+
def _08c_rightTriangle.getAllTriangles | ( | n | ) |
Generates and interleaves all four orientations for printing.
n | triangle height. |
References _01d_dec2bin.input, and rightTriangle().
def _08c_rightTriangle.rightTriangle | ( | n, | |
orientation = 0 |
|||
) |
Return a string representing the right triangle of height n in a given orientation.
n | triangle height. |
orientation | 0 up, 1 down, 2 right, 3 left. |
Referenced by getAllTriangles().