Browse Source

Added comments to roo say

pull/1/head
Jeffery Russell 7 years ago
parent
commit
5a8376bcab
1 changed files with 28 additions and 5 deletions
  1. +28
    -5
      src/roosay.py

+ 28
- 5
src/roosay.py View File

@ -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()

Loading…
Cancel
Save