News for hackers. Stuff that matters.
Re:My Favorite Programming Problem to Teach: Digit Length by AlecSchueler on Monday November 11, 2019 @04:46AM (#21503370)
This problem is a funny one for me and gives me real nostalgia, back to about ten years ago when I was learning to program.

I'd just picked up python and was having so much fun going through the project Euler problems.

I can't remember which question it was for but we had to know the length of an integer. At that point I hadn't learnt about type conversion so had to implement it the way the author wants his students to do it.

I remember fondly as well that I hadn't learnt about the modulo operator and had to implement that by myself as well.

I couldn't believe it when I got the answer and progressed to the forum where others shared their answers and they were doing it on one line with %!

Good times!

There are no comments on this comment yet.