def secondLargestNumber(array):
    Maximum = Max.Max(array)
    for iterator in array:
        if Maximum == iterator:
            array.remove(iterator)
    maximum = Max.Max(array)
    return maximum
예제 #2
0
def secondLargestNumber(array):
    v = Max.Max(array)
    for i in array:
        if v == i:
            array.remove(i)
    maxi = Max.Max(array)

    return maxi
예제 #3
0
def kth_largest_ele(array,kthelement):
    lenght = FindLenght.count(array)
    iterator = 1
    while(iterator!=kthelement):
        largestElemnt = Max.Max(array)
        for element in array:
            if (element == largestElement):
                 array.remove(largestElement)
         iterator += 1
    largestElement = Max.Max(array)
    return largestElement
def kth_largest_ele(array,kthele):
    lenght = FindLenght.count(array)
    if (lenght == kthele):
        return find_min.findMin(array)
    else:

        iterator = 1
        while(iterator!=kthele):
            Largest_ele = Max.Max(array)
            for j in array:
                if (j == Largest_ele):
                    array.remove(Largest_ele)
            iterator += 1
        Largest_ele = Max.Max(array)
    return Largest_ele
예제 #5
0
def test_arrayretutn7():
    #arrange
    values = [5, 2, 4, 7, 3, 5]
    excepted = 7
    #act
    actual = Max.Max(values)
    #assert
    assert excepted == actual
예제 #6
0
 def test_max(self):
     test_package_1 = [('word1', 10), ('word2', 20), ('word_max', 100)]
     test_package_2 = [('word1', 10), ('word_max', 100), ('word2', 20)]
     test_package_3 = []
     max_instance = Max.Max()
     self.assertEqual(('word_max', 100),
                      max_instance.count_maximum(test_package_1))
     self.assertEqual(('word_max', 100),
                      max_instance.count_maximum(test_package_2))
     self.assertEqual(('', -1), max_instance.count_maximum(test_package_3))
예제 #7
0
def find_most_occureence(array):  # the main function
    dictionary = built_dictionary(array)
    values = list(
        dictionary.values())  # converting the dictonary value to a list
    if (Equate.Equate(values)):
        max_element = Max.Max(values)
        key = find_key_from_dictionary(dictionary, max_element)
        print("the number {1} appears {0} times".format(max_element, key))
    else:
        print("Can't find the most occurence of an element")
def kth_smallest_ele(array, kthele):
    smallest_ele = 1
    iterator = 1
    lenght = FindLenght.count(array)
    while (iterator != kthele):
        if lenght == kthele:
            return Max.Max(array)
        else:
            smallest_ele = find_min.findMin(array)
            for j in array:
                if (j == smallest_ele):
                    array.remove(smallest_ele)
            iterator += 1
        smallest_ele = find_min.findMin(array)
    return smallest_ele
예제 #9
0
 def max_from_file(self):
     words_and_scores = self.count_for_all()
     max_counter = Max.Max()
     return max_counter.count_maximum(words_and_scores)
예제 #10
0
def find_largest_numbers_occurences(array): #Main method 
    max = Max.max(array)
    count = count_occuences(array,max)
    return count