Skip to content

Instantly share code, notes, and snippets.

@ayubmetah
Created December 18, 2020 03:45
Show Gist options
  • Save ayubmetah/bf0ad0270d5b433830fbcf5c7e3eb987 to your computer and use it in GitHub Desktop.
Save ayubmetah/bf0ad0270d5b433830fbcf5c7e3eb987 to your computer and use it in GitHub Desktop.
Adding values in a loop
values = [23, 52, 59, 37, 48]
sum = 0
length =0
for value in values:
sum += value
length += 1
print("Total sum: " + str(sum) + " - Average: " + str(sum/length))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment