Skip to content

Instantly share code, notes, and snippets.

@sp90
Created November 15, 2018 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sp90/b49501ab51764fbb5d77dd4a11e6a01c to your computer and use it in GitHub Desktop.
Save sp90/b49501ab51764fbb5d77dd4a11e6a01c to your computer and use it in GitHub Desktop.
Finding the lowest number and count the amount of occurrences
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