diff options
Diffstat (limited to 'comp/work/13/find_smallest.py')
-rwxr-xr-x | comp/work/13/find_smallest.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/comp/work/13/find_smallest.py b/comp/work/13/find_smallest.py new file mode 100755 index 0000000..362383a --- /dev/null +++ b/comp/work/13/find_smallest.py @@ -0,0 +1,9 @@ +def find_smallest(numbers): + smallest = numbers[0] + for i in numbers: + if i < smallest: + smallest = i + return smallest + +numbers = [3, 6, 2, 8, 4, 1] +print(find_smallest(numbers)) |