Skip to content

Instantly share code, notes, and snippets.

@fatred
Created October 20, 2020 08:37
Show Gist options
  • Save fatred/041de2cf7f7db6f8d46aae228e81ecfa to your computer and use it in GitHub Desktop.
Save fatred/041de2cf7f7db6f8d46aae228e81ecfa to your computer and use it in GitHub Desktop.
Python3 solution to the even-number problem from Essential Go Training (for performance comparison purposes)
#!/usr/bin/env python3
even_numbers = 0
x = 1000
y = 1000
while (x <= 9999):
y = x
while (y <= 9999):
result = x * y
if str(result)[0] == str(result)[len(str(result))-1]:
even_numbers = even_numbers + 1
y = y + 1
x = x + 1
print(even_numbers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment