5 ms·
This reminds me how most people seem to see programming as some sort of black magic that only happens when the stars align just-so. If only they were aware of
by fendrak 16y ago
This reminds me how most people seem to see programming as some sort of black magic that only happens when the stars align just-so. If only they were aware of how different things actually are...
Python solution:
def under_the_limit(response):
return len(response.split()) <= 150
- joeld42 16y agoThis is wrong. They're not checking for 150 words. They need to check that, once typeset on the printable form, the text fits in a box of a certain size. Still, whatever they are using to typeset the form should be able to easily give them that info. Even if, god forbid, they are doing it with HTML they can get that info. Much simpler would be to design the form with a monospaced font for the essay. This is a big reason why manuscripts are still submitted in Courier even though few people use typewriters anymore.
- ghshephard 16y agoYES - I was wondering why nobody had brought up the painfully straight forward solution of "Fixed Width Font" - Then your bounding area is a simple function of the number of characters you typed in, and an error message can pop up if the student exceed it.
- chc 16y agoIt's not quite that simple even with a monospace font unless you wrap words unnaturally. For example, the word "heterochromatic" repeated over and over with a space between fills up the HN comment box in 288 characters, but "I DO" makes it to 359.
- rflrob 16y agoThere's actually a lot more that could go into figuring out whether a given passage will fit, but arguably a gold standard solution exists, and is freely available: to wit in TeX. While it's probably not trivial to adapt the relevant code, it's not like no solution exists, as the quote implied.
- waterlesscloud 16y agoI really don't understand how an error that fundamentally fails the target use-case can stand for a decade. And how they just can't figure it out. That just seems insane.