5 ms·
It wouldn't, because in English as in programming -- the 'and' operator has precedence.
by vanusa 5y ago
It wouldn't, because in English as in programming -- the 'and' operator has precedence.
- kzrdude 5y agoit's an intelligence so it can make sense of it to the best of its ability, even if the input is malformed. :)
- vanusa 5y agoA truly intelligent machine would hand the test back to the instructor, saying: "Nice try, but I think you need to edit these questions a bit more carefully. Now if you'll excuse me, I'd like to treat myself to an early recess."
- kzrdude 5y agoIntelligent students know that it doesn't work to try this on the teacher, so it sounds like the machine still isn't quite AGI :)
- c1ccccc1 5y agoSo I guess the answer would be 5 then. 7 & 13 = 0b0111 & 0b1101 = 0b0101 = 5
- Jensson 5y agoIn python 7 and 13 is 13. 7 is true, so it returns the second part of the and statement which is 13. So the answer is 13. Code below as proof: > print(13 % (7 and 13)) outputs: 0.
- vanusa 5y agoI was wrong! I failed FizzBuzz! The English 'and' doesn't have the same precedence as in software - it actually goes in the opposite direction. What it does in English is this: Find the smallest prime number that ( (is divisible by 7) and (is divisible by 13) ) The point I was trying to make was is: the English meaning of this sentence is unambiguous. And it's obvious the algorithm here in no way understands this meaning. It's just dissecting parse trees, and hitting the shuffle button.