3 ms·
does not "or" imply a boolean
by genewitch 11mo ago
does not "or" imply a boolean
- jswelker 11mo agoIt does.Will you accept max? fizzbuzz = ["", "", "Fizz", "", "Buzz", "Fizz", "", "", "Fizz", "Buzz", "", "Fizz", "", "", "FizzBuzz"] for i in range(1,101): print(max((fizzbuzz[(i-1)% 15],str(i),))) Probably still bools under the hood.
- TZubiri 11mo agoDoesn't a for loop contain a conditional? (If i <101)
- jswelker 11mo agoThat is in arbitrary line I am willing to draw in the battle against pedantry. Surely though a fizzbuzz isn't supposed to run forever though right? Gotta end it somehow, and the for loop is idiomatic.
- TZubiri 11mo agoIt's a challenge and you can do whatever version you want. If I'm pedantring about it it's because it can be done with a stricter restriction (or at least I think it can be done). I'd also add that it isn't a particularly hard problem, so I would recommend that if you are having trouble with solving for the hardest interpretation of the problem, that you keep on trying because there is quite a simple solution. If I were hiring based on this, your answer is a pass for sure. But it isn't exactly clear to me that you know about cpu comparisions or conditional jumps. In fact I think if you knew about them you wouldn't call it an arbitrary line. I think there is a python solution as a prototype, but of course the robust solution would be in python to ensure control over the cpu instructions and avoid conditionals for good.
- jswelker 11mo agoYou got me. I'd surely fail your interview. I admit I know nothing about CPU comparisons and conditional jumps.