1

Which of the following has the complement behavior in python?

a) ~
b) not
c) <>
d) !

I answered (a). but it was shown as wrong. What is the correct answer?

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
  • 3
    It's a. Take a look at: https://wiki.python.org/moin/BitwiseOperators – davidgiga1993 Jul 13 '15 at 07:07
  • 2
    When (a) is not correct, they probably confused bitwise (`~`) complement with logical (`not`) complement. So the proper answer would have been to ask to clarify. – dhke Jul 13 '15 at 07:30
  • Please stop posting questions like these. StackOverflow is for practical questions that can be answered to solve applicable problems. It's not a place for you to have test questions about the language explained to you. – SuperBiasedMan Jul 13 '15 at 16:07
  • @SuperBiasedMan what puzzles me is that this is his 2nd question that he supposedly chose the right answer and the quiz marked it as wrong. I don't object about him asking valid questions as long as he has checked for duplicates... Even if they are not his questions... – Armfoot Jul 13 '15 at 16:58
  • @Armfoot These questions aren't useful to keep though. Test questions on Python language specs would be questionable, but the questions and answers sound poorly formed to begin with so they wont do much good. – SuperBiasedMan Jul 13 '15 at 17:00
  • @SuperBiasedMan yes, his questions show lack of research/effort and they are in the "do my homework" category... Still, they seem valid and resemble these: ["how to negate in JS"](http://stackoverflow.com/questions/6684051/how-to-negate-code-in-if-statement), ["what is the !! operator"](http://stackoverflow.com/questions/784929/what-is-the-not-not-operator-in-javascript), ["how to loop in JS"](http://stackoverflow.com/questions/3010840/loop-through-array-in-javascript)... – Armfoot Jul 13 '15 at 17:09

0 Answers0