3 ms·
The superfluous semicolons on line endings in the C example gave me a chuckle.
by jevinskie 13y ago
The superfluous semicolons on line endings in the C example gave me a chuckle.
- drivers99 13y agoHe forgot one on the "i += 1" (which would be i++ in a for loop but Python doesn't have that operator). But that whole line is weird, because I think the C example should use a "for" loop, not increment the main counter at the top of a while loop, even if it has to use "for i in range(1, 101)" like in pythonic python. A C programmer like me (who loves python too) would immediately think "for (i = 1; i <= 100; i++)" for that (although counting from 1 is strange, it's what the problem asks for).
- eriktaubeneck 13y agoThis is what I originally had but I felt that the Python `while` was actually a bit more true to the way a C for loop is constructed (and `range` seems a very not C thing to do.) It's not perfect!
- Nav_Panel 13y agoHeh, in the C version I wish that "value = str(i);" was replaced with "value = "%d" % (i);" Format strings feel like C. And not the fun parts of C.