diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c88a605 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +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..064cb37 100644 --- a/src/main/calculator.py +++ b/src/main/calculator.py @@ -1,13 +1,14 @@ # 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 # TODO - Implement solution def subtract(self, a, b): - return None # TODO - Implement solution + return a - b # TODO - Implement solution def multiply(self, a, b): - return None # TODO - Implement solution + return a * b # TODO - Implement solution def divide(self, a, b): - return None # TODO - Implement solution + return round((a/b), 3)# TODO - Implement solution diff --git a/src/main/perscholas_rocks.py b/src/main/perscholas_rocks.py index d36d3bd..dced419 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..70eb467 100644 --- a/src/main/predicator.py +++ b/src/main/predicator.py @@ -1,13 +1,26 @@ # 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 # TODO - Implement solution def is_greater_than_8(self, some_value): - return None # TODO - Implement solution + if some_value > 8: + return True + else: + return False # TODO - Implement solution def is_less_than_4(self, some_value): - return None # TODO - Implement solution + if some_value < 4: + return True + else: + return False # TODO - Implement solution 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 # TODO - Implement solution \ No newline at end of file diff --git a/src/main/string_evaluator.py b/src/main/string_evaluator.py index 38b007a..6fefaa5 100644 --- a/src/main/string_evaluator.py +++ b/src/main/string_evaluator.py @@ -1,28 +1,45 @@ # 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" # TODO - Implement solution def concatenate(self, value_to_be_added_to, value_to_add): - return None # TODO - Implement solution + a = str(value_to_be_added_to) + b = str(value_to_add) + c = a + b + return c # TODO - Implement solution def substring_inclusive(self, string_to_fetch_from, starting_index, ending_index): - return None # TODO - Implement solution + string = string_to_fetch_from[starting_index:ending_index+1] + return string # TODO - Implement solution def substring_exclusive(self, string_to_fetch_from, starting_index, ending_index): - return None # TODO - Implement solution + line = string_to_fetch_from[starting_index+1:ending_index] + return line # TODO - Implement solution def compare(self, first_value, second_value): - return None # TODO - Implement solution + if str(first_value) == str(second_value): + return True + elif first_value == None and second_value == 0: + return True + elif first_value == False and second_value == 0: + return True + elif first_value == True and second_value == 1: + return True + else: + return False # TODO - Implement solution def get_middle_character(self, string_to_fetch_from): return None # TODO - Implement solution def get_first_word(self, string_to_fetch_from): - return None # TODO - Implement solution + word = string_to_fetch_from.split() + return word[0]# TODO - Implement solution def get_second_word(self, string_to_fetch_from): - return None # TODO - Implement solution + word2 = string_to_fetch_from.split() + return word2[1] # TODO - Implement solution def reverse(self, string_to_be_reversed): return None # TODO - Implement solution \ No newline at end of file