diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..82b0e9a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: python +script: + python -m unittest discover -s ./src/test/ -p '*_test.py' + diff --git a/src/main/calculator.py b/src/main/calculator.py index b874a57..aa95dc3 100644 --- a/src/main/calculator.py +++ b/src/main/calculator.py @@ -1,13 +1,16 @@ # Created by Leon Hunter at 9:54 AM 10/23/2020 class Calculator(object): def add(self, a, b): - return None # TODO - Implement solution + return a + b def subtract(self, a, b): - return None # TODO - Implement solution + return a - b def multiply(self, a, b): - return None # TODO - Implement solution + return a * b def divide(self, a, b): - return None # TODO - Implement solution + if (b != 0): + return a / b + else: + return ZeroDivisionError diff --git a/src/main/perscholas_rocks.py b/src/main/perscholas_rocks.py index d36d3bd..8b719cc 100644 --- a/src/main/perscholas_rocks.py +++ b/src/main/perscholas_rocks.py @@ -1 +1 @@ -# print("Perscholas Rocks!") # TODO - Implement solution \ No newline at end of file +print("Perscholas Rocks!") # TODO - Implement solution \ No newline at end of file diff --git a/src/main/predicator.py b/src/main/predicator.py index d0ca9bd..fa60e5e 100644 --- a/src/main/predicator.py +++ b/src/main/predicator.py @@ -1,13 +1,28 @@ # Created by Leon Hunter at 3:56 PM 10/23/2020 class Predicator(object): def is_greater_than_5(self, some_value): - return None # TODO - Implement solution + if (some_value > 5): + return True + else: + return False + def is_greater_than_8(self, some_value): - return None # TODO - Implement solution + if (some_value > 8): + return True + else: + return False + def is_less_than_4(self, some_value): - return None # TODO - Implement solution + if (some_value < 4): + return True + else: + return False + def is_less_than_1(self, some_value): - return None # TODO - Implement solution \ No newline at end of file + if(some_value < 1): + return True + else: + return False \ No newline at end of file diff --git a/src/main/string_evaluator.py b/src/main/string_evaluator.py index 38b007a..b10793f 100644 --- a/src/main/string_evaluator.py +++ b/src/main/string_evaluator.py @@ -1,28 +1,29 @@ # Created by Leon Hunter at 3:57 PM 10/23/2020 class StringManipulator(object): def get_hello_world(self): - return None # TODO - Implement solution + return "Hello World" def concatenate(self, value_to_be_added_to, value_to_add): - return None # TODO - Implement solution + return value_to_be_added_to + value_to_add def substring_inclusive(self, string_to_fetch_from, starting_index, ending_index): - return None # TODO - Implement solution + return string_to_fetch_from[starting_index : ending_index] def substring_exclusive(self, string_to_fetch_from, starting_index, ending_index): - return None # TODO - Implement solution + return string_to_fetch_from[starting_index +1 : ending_index -1] def compare(self, first_value, second_value): - return None # TODO - Implement solution + return first_value == second_value def get_middle_character(self, string_to_fetch_from): - return None # TODO - Implement solution + middleIndex = len(string_to_fetch_from)/2 + return string_to_fetch_from[middleIndex] def get_first_word(self, string_to_fetch_from): - return None # TODO - Implement solution + return string_to_fetch_from.split(" ") def get_second_word(self, string_to_fetch_from): return None # TODO - Implement solution def reverse(self, string_to_be_reversed): - return None # TODO - Implement solution \ No newline at end of file + return string_to_be_reversed[::-1] \ No newline at end of file