Skip to content

Instantly share code, notes, and snippets.

@dynamicy
Created August 9, 2022 15:56
Show Gist options
  • Save dynamicy/cede6d8b3f8fdc4e600e1476ae300ee0 to your computer and use it in GitHub Desktop.
Save dynamicy/cede6d8b3f8fdc4e600e1476ae300ee0 to your computer and use it in GitHub Desktop.
python code sample 1
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