Skip to content

Instantly share code, notes, and snippets.

@ehedaoo
Created May 2, 2017 10:28
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 ehedaoo/3c59aac4809f8acf215ed319e5495c9c to your computer and use it in GitHub Desktop.
Save ehedaoo/3c59aac4809f8acf215ed319e5495c9c to your computer and use it in GitHub Desktop.
Write a Python program to get the smallest number from a list. Using Functions
# Write a Python program to get the smallest number from a list.
# Using Functions
# a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
def min_item(a):
flag = a[0]
for i in a:
if i < flag:
flag = i
return flag
a = [1, 1, 2, 3, 0, 5, 8, 13, 21, 34, 55, 89]
print(min_item(a))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment