Created
August 9, 2022 15:56
-
-
Save dynamicy/cede6d8b3f8fdc4e600e1476ae300ee0 to your computer and use it in GitHub Desktop.
python code sample 1
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
def sum_range(start: int, end: int) -> int: | |
sum = 0 | |
for x in range(start, end+1): | |
sum += x | |
return sum | |
print(sum_range(0,5)) | |
def sum_evens(start: int, end: int) -> int: | |
sum = 0 | |
for x in range(start, end+1): | |
if x % 2 == 0: | |
sum += x | |
return sum | |
print(sum_evens(0,5)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment