Eric - Blogpost this...

BTW - Images did not come though on message board, at least not to me.



*Matt Slay*



On 01/22/2020 12:11 PM, Eric Selje wrote:
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
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/57732e21-db82-5a1b-9e7a-b1411a6ae...@jordanmachine.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to