other.magicdiamondpattern

Functions

floyd(n)

Print the upper half of a diamond pattern with '*' characters.

pretty_print(n)

Print a complete diamond pattern with '*' characters.

reverse_floyd(n)

Print the lower half of a diamond pattern with '*' characters.

Module Contents

other.magicdiamondpattern.floyd(n)

Print the upper half of a diamond pattern with ‘*’ characters.

Args:

n (int): Size of the pattern.

Examples:
>>> floyd(3)
'  * \n * * \n* * * \n'
>>> floyd(5)
'    * \n   * * \n  * * * \n * * * * \n* * * * * \n'
other.magicdiamondpattern.pretty_print(n)

Print a complete diamond pattern with ‘*’ characters.

Args:

n (int): Size of the pattern.

Examples:
>>> pretty_print(0)
'       ...       ....        nothing printing :('
>>> pretty_print(3)
'  * \n * * \n* * * \n* * * \n * * \n  * \n   '
other.magicdiamondpattern.reverse_floyd(n)

Print the lower half of a diamond pattern with ‘*’ characters.

Args:

n (int): Size of the pattern.

Examples:
>>> reverse_floyd(3)
'* * * \n * * \n  * \n   '
>>> reverse_floyd(5)
'* * * * * \n * * * * \n  * * * \n   * * \n    * \n     '