0

If I have a char d and a char k, how do I turn each into a bit array (such as True-False-True-True-True-False-False-True) and then combine the arrays into a single array by AND-ing each bit (and then turning the combined array back into a char)? Such as 01100001 (a) and 01100011 (c) combine to make 01100001 (c)? Also, sometimes the results of these conversions are not ASCII (such as 00000010)?

3
  • 1
    00000010, ^B, is indeed ASCII, just not printable Commented Sep 8, 2011 at 22:42
  • and why turn them into a bit array? just and the numbers Commented Sep 8, 2011 at 22:46
  • 2
    Part of asking good questions is asking what you really want to know about. Don't assume more about how to solve the problem than you really need to. Here, you want the bitwise-AND of the two characters; "turning them into bit arrays" is a useless diversion. Commented Sep 8, 2011 at 23:14

1 Answer 1

4

no need to make an array:

>>> chr(ord('c') & ord('a'))
'a'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.