zlacker

[return to "My Favorite Programming Problem to Teach: Digit Length"]
1. svnpen+Jm[view] [source] 2019-11-11 03:14:08
>>jstrie+(OP)
> As a result, solutions using strings are disallowed on problem sets and quizzes until they are taught. However, the few students who have prior Python programming experience may be tempted to find digit length without loops using a variant of the following (for our purposes) invalid solution.

Wow. this is one of the reasons I hated school. No programmatic reason what given for why a string solution couldnt be used, only an arbitrary reason. Here students may have knowledge from self teaching or whatever, but they are unallowed to use that knowledge because "reasons".

To any teacher that thinks its a good idea to punish students for thinking outside the box: shame on you. All youre going to end up doing is crushing enthusiasm and/or creating drones. Please dont.

◧◩
2. lilyba+tv[view] [source] 2019-11-11 05:25:59
>>svnpen+Jm
> No programmatic reason what given for why a string solution couldnt be used, only an arbitrary reason

The entire problem is arbitrary. It's not a real-world problem looking for a solution. It's a programming exercise.

◧◩◪
3. cjfd+X81[view] [source] 2019-11-11 13:58:43
>>lilyba+tv
Actually, this problem does occur in practice. When one needs to output some numbers in a column it can be important how wide the widest one is. Ironically, in that case the numbers are going to be converted to text anyway so you might as well use the string size....
[go to top]