|
| 1 | +from typing import List, Tuple, Set, TypeVar |
| 2 | + |
| 3 | +N = TypeVar('N', int, float) |
| 4 | +C = TypeVar('C', List, Tuple) |
| 5 | + |
| 6 | + |
| 7 | +def find_lowest_value(list_in: List[N]) -> N: |
| 8 | + """ |
| 9 | + Returns the lowest value in a list of numbers. |
| 10 | +
|
| 11 | + :param list_in: A list of numbers (integers and/or floats) |
| 12 | + :return: The lowest number in the list |
| 13 | + """ |
| 14 | + pass # implement me |
| 15 | + |
| 16 | + |
| 17 | +def find_highest_value(list_in: List[N]) -> N: |
| 18 | + """ |
| 19 | + Returns the highest value in a list of numbers. |
| 20 | +
|
| 21 | + :param list_in: A list of numbers (integers and/or floats) |
| 22 | + :return: The highest number in the list |
| 23 | + """ |
| 24 | + pass # implement me |
| 25 | + |
| 26 | + |
| 27 | +def find_value(value_to_find, values: C) -> int: |
| 28 | + """ |
| 29 | + This function evaluates whether a value exists within a List or a Set. |
| 30 | + If the value exists, the function returns the index of the value in the collection. |
| 31 | + If the value does not exist, the function returns -1. |
| 32 | +
|
| 33 | + :param value_to_find: A value that may or may not exist within a collection. |
| 34 | + :param values: A List or a Set. |
| 35 | + :return: an integer. Either the index where the value exists or -1 |
| 36 | + """ |
| 37 | + pass # implement me |
| 38 | + |
| 39 | + |
| 40 | +def compare_two_numbers(a: N, b: N) -> int: |
| 41 | + """ |
| 42 | + Compares two numbers. |
| 43 | +
|
| 44 | + If the numbers are the same, this function will return the number 0. |
| 45 | + If the first number is greater than the second, this function will return the number 1. |
| 46 | + If the second number is greater than the second, this function will return the number -1. |
| 47 | +
|
| 48 | + :param a: The first number. |
| 49 | + :param b: The second number. |
| 50 | + :return: an integer 0, 1, or -1 |
| 51 | + """ |
| 52 | + pass # implement me |
| 53 | + |
| 54 | + |
| 55 | +def compare_two_strings(a: str, b: str) -> int: |
| 56 | + """ |
| 57 | + Compares two strings. |
| 58 | +
|
| 59 | + If the strings have the same length, this function will return the number 0. |
| 60 | + If the first string is longer than the second string, this function will return the number 1. |
| 61 | + If the second string is longer than the first string, this function will return the number -1. |
| 62 | +
|
| 63 | + :param a: The first string. |
| 64 | + :param b: The second string. |
| 65 | + :return: an integer 0, 1, or -1 |
| 66 | + """ |
| 67 | + pass # implement me |
| 68 | + |
| 69 | + |
| 70 | +def find_common(tuple_a: Tuple, tuple_b: Tuple) -> Set: |
| 71 | + """ |
| 72 | + Given two tuples, this function returns a set containing items common in both tuples. |
| 73 | +
|
| 74 | + :param tuple_a: The first tuple. |
| 75 | + :param tuple_b: The second tuple. |
| 76 | + :return: A set containing items common on both tuples. |
| 77 | + """ |
| 78 | + pass # implement me |
| 79 | + |
| 80 | + |
| 81 | +def find_duplicates(tuple_in: Tuple) -> List: |
| 82 | + """ |
| 83 | + Given a tuple, this function returns a list of the items that contain more than one instance. |
| 84 | +
|
| 85 | + :param tuple_in: A tuple |
| 86 | + :return: a A list containing duplicate items in the tuple_in parameter |
| 87 | + """ |
| 88 | + pass # implement me |
0 commit comments