zlacker

[return to "My favorite programming problem to teach: Digit length (2019)"]
1. Strila+Qe3[view] [source] 2024-06-06 06:29:57
>>equili+(OP)
It's very strange to me that the teacher would push the students from the correct solution using a loop, towards an incorrect solution using a logarithm. A logarithm could work in a language like C where ints can't get too large, but Python has arbitrary precision integers so any solution using floating point numbers is doomed. For example, the code given in the post returns 16 instead of 15 for 999_999_999_999_999.
◧◩
2. smarkl+Fq3[view] [source] 2024-06-06 08:24:54
>>Strila+Qe3
I've come to the retrospective conclusion decades after educational abuse that professors like this are more interested in showboating their mathematics knowledge than drive students to find good pragmatic solutions.

i.e. I know this super complex answer in which is it happens to be the only purely accurate thing. Can you guess it? vs what I would like to see which is: here are the foundational concepts, bring them all together and arrive at the naturally correct conclusion demonstrating your knowledge and understanding

◧◩◪
3. romwel+3t3[view] [source] 2024-06-06 08:49:38
>>smarkl+Fq3
Professors?

This post was written by an undergraduate student.

A professor would use that as a teaching opportunity to discuss the folly of relying on floating point numbers.

[go to top]