migrate to git.charlotte.sh
This commit is contained in:
commit
fbd588721e
412 changed files with 13750 additions and 0 deletions
15
python-csi160/week05/week-5Practice-Problems/part7.py
Normal file
15
python-csi160/week05/week-5Practice-Problems/part7.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
def second_smallest(numbers):
|
||||
"""Returns the second smallest number
|
||||
|
||||
:param numbers: (list) List of numbers of at least size 2
|
||||
:return: (int or float) The second smallest number
|
||||
"""
|
||||
numbers.sort()
|
||||
return numbers[1]
|
||||
|
||||
|
||||
# Leave this part for easily testing your function
|
||||
print('[6, 3, 9, 2, 1] second_smallest returns', second_smallest([6, 3, 9, 2, 1]))
|
||||
print('[23, 23.25, 23.5, 23] second_smallest returns', second_smallest([23, 23.25, 23.5, 23]))
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue