Skip to content

Instantly share code, notes, and snippets.

@stephaniemdavis
Last active June 23, 2018 12:17
Show Gist options
  • Save stephaniemdavis/48cb9afdb34289ab5c6552c75f074dcd to your computer and use it in GitHub Desktop.
Save stephaniemdavis/48cb9afdb34289ab5c6552c75f074dcd to your computer and use it in GitHub Desktop.
A function which sums integers between 1 and some defined upper limit end
'''
Written 6-23-2018 s.m.d
Implementation of EdX Introduction to Computation & Programming Using Python
'''
# initialization state: grand_sum, incrementer, end
def sum_total(end):
grand_sum = 0
incrementer = 1
end = input("Enter a positive integer please, any positive integer") # instantiate and upper limit integer
end = int(end) # convert end to an integer type
while incrementer <= end:
grand_sum = incrementer
incrementer += 1
return(grand_sum)
print(sum_total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment