From 5a8376bcab2ce61acfd5b5aaac94382a59691156 Mon Sep 17 00:00:00 2001 From: jrtechs Date: Sun, 8 Oct 2017 18:28:08 -0400 Subject: [PATCH] Added comments to roo say --- src/roosay.py | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/roosay.py b/src/roosay.py index ba9ac72..d8d509b 100644 --- a/src/roosay.py +++ b/src/roosay.py @@ -1,13 +1,16 @@ """ -Makes sure that other programs don't execute the main +Python script that prints an ascii roo with a message above it +Jeffery Russell +10-8-17 """ import sys + def main(): """ - - :return: + checks for command line arguments + :return: None """ message = "" for i in range(1, len(sys.argv)): @@ -17,11 +20,21 @@ def main(): def roo_say(message): + """ + Method which prints an ascii roo with a message above it + :param message: the message to print + :return: none + """ print_message(message) print_roo() def print_message(message): + """ + Prints the message above Roo + :param message: the message to print + :return: None + """ print_list, max_len= convert_to_list(message) if len(print_list) > 0: @@ -41,13 +54,16 @@ def print_message(message): print("| " + print_list[i] + " " * (max_len - len(print_list[i])) + " |") "print bottom" print(" " + "-" * (max_len + 2)) - - else: print("Please pass in a message parameter") def convert_to_list(message): + """ + Converts the message into string lines which are less than 35 characters - easier for printing + :param message: the string message + :return: the list of the string lines and the length of the longest line + """ temp_build = "" temp_return = [] max_len = 0 @@ -67,6 +83,10 @@ def convert_to_list(message): def print_roo(): + """ + prints the roo ascii + :return: None + """ print("") print(" \ /)/)") print(" \ (ø.ø)") @@ -77,5 +97,8 @@ def print_roo(): print(" \"--~(/") +""" +If ran from command line this will call main which looks for command line arguments +""" if __name__ == '__main__': main() \ No newline at end of file