Last active
June 23, 2018 12:17
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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