Created
November 15, 2018 16:52
-
-
Save sp90/b49501ab51764fbb5d77dd4a11e6a01c to your computer and use it in GitHub Desktop.
Finding the lowest number and count the amount of occurrences
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list_of_numbers = [1, 2 , 1, 3] | |
def find_count_of_lowest(numbers): | |
numbers.sort() | |
lowest_number = numbers[0] | |
count_lowest_number = 0 | |
for number in numbers: | |
if number == lowest_number: | |
count_lowest_number += 1 | |
return count_lowest_number | |
print(find_count_of_lowest(list_of_numbers)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment