Created
October 20, 2020 08:37
-
-
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)
This file contains 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
#!/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