Today in another trivia board I'm on, there was this math question:
"Identify a multi-digit number such that when each digit is raised to the
power of itself, and the result of each of those is added together you get
the original number."
eg: 274 = (2 ^ 2) + (7 ^ 7) + (4 ^ 4)
We were given the hint that it's 4 digits, which was helpful. I quickly
wrote this FoxPro script to figure it out for me:
[image: image.png]
But then I thought, I should really figure out how to do this in Python if
I'm ever really going to learn. I've run through a few online tutorials,
but I still had to google how to do for loops, how to convert integers into
strings and then parse that string, how exponentiation worked, even how if
statements work. Finally got it to this.
[image: image.png]
Just sharing this extremely simple example in case anyone's interested. But
glad I went through the exercise.
Eric
--- StripMime Report -- processed MIME parts ---
multipart/related
multipart/alternative
text/plain (text body -- kept)
text/html
image/png
image/png
---