Skip to content

Instantly share code, notes, and snippets.

@cbscribe
Created February 12, 2021 21:27
Show Gist options
  • Save cbscribe/8622222d281bad12d758ff303e64e108 to your computer and use it in GitHub Desktop.
Save cbscribe/8622222d281bad12d758ff303e64e108 to your computer and use it in GitHub Desktop.
FInd largest number in a list
numbers = [1, 5, 0, 39, 6, 809, 39, 2]
biggest = numbers[0]
for num in numbers:
if num > biggest:
biggest = num
print(biggest)
@cbscribe
Copy link
Author

Use this pattern when you want to find the biggest/smallest/etc value in some list of values.

@LaneEverettSA
Copy link

:O

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment