5
$\begingroup$

I need your help. I think my computer is gaining sentience. I went to a play, but when I got back this file was saved on my desktop:

#!/usr/bin/env python3
# -*- coding: latin8 -*-
i = input("Please enter a character: ")
print((i == "Ä" or i == ";"))

(note: The original riddle had a colon : instead of a semicolon ;. This was my fault, the correct character is a semicolon)

It was saved as question.py. I know I didn't write this! I think my computer is trying to ask me a question, but I can't tell what the question is.

What question is my computer asking me?


To avoid confusing people, this is not a unicode trick. The "Ä" character is encoded as a single byte, 0xC4.

Hint:

The question is a famous line

$\endgroup$
20
  • 3
    $\begingroup$ Well, technically, it's asking you to 'Please enter a character'. I think you're looking for something less obvious though. $\endgroup$ May 19, 2016 at 5:54
  • 4
    $\begingroup$ @BaSzAt Yes, it actually is saved in Latin8, and that is important and relevant. $\endgroup$
    – DJMcMayhem
    May 19, 2016 at 8:22
  • 2
    $\begingroup$ en.m.wikipedia.org/wiki/ISO/IEC_8859-14 link to the codepahe $\endgroup$ May 19, 2016 at 10:27
  • 5
    $\begingroup$ Those are characters 0xC4 and 0x3A in the Latin-8 encoding. (In particular, they are regrettably not 0x2B and ~0x2B.) In decimal, 196 and 58. $\endgroup$
    – Gareth McCaughan
    May 19, 2016 at 10:40
  • 4
    $\begingroup$ "Give me plastic explosives or give me emergency roadside service" $\endgroup$ May 19, 2016 at 11:53

3 Answers 3

6
$\begingroup$

Just a guess:

Could your computer be asking the question: "To be or not to be?" from Shakespeare's Hamlet? My reasoning was simmilar to Caelan's, except I expected to get the Hex value 0x2B from ord('Ä'), but it was giving me 196 (0xC4), and I didn't think to divide by two. If I did so, I would have found that the unicode encoding was 'b', chr(196/2) == 'b', but I just didn't have time to think through my answer, and posted this guess on a hunch. However, looking back If you take unichr(59) which is the ~ (binary NOT) operation of the hex value '0xc4' (~196 is negative).

$\endgroup$
6
  • 1
    $\begingroup$ Interesting, this might be it, but please explain your thoughts. $\endgroup$
    – fffred
    May 19, 2016 at 10:10
  • 3
    $\begingroup$ 2B is '+' and ~2B is is 'Ô' $\endgroup$ May 19, 2016 at 10:21
  • $\begingroup$ Great guess. What's your reasoning? $\endgroup$
    – DJMcMayhem
    May 19, 2016 at 13:03
  • $\begingroup$ You got this first therefore are getting my upvote, if you had added an explanation this would have been accepted for sure $\endgroup$ May 19, 2016 at 15:09
  • $\begingroup$ @Caelan Updated answer with reasoning, includes reasoning for ";" as well. $\endgroup$ May 19, 2016 at 21:17
6
$\begingroup$

To be or not to be? (Well, more "2b or not 2b")

My reasoning:

The unicode code for Ä is U+00C4. The key part here is C4.
If we translate C4 from hexadecimal to decimal, we get the number 196. Half of 196 is 98.
Let's now translate 98 from decimal to hexadecimal to get 62, and look for unicode code U+0062.
The letter that comes out is b. Note that 196 being 2 times 98 is where the two comes from. Whatever you do for the colon, you will come to something that is not 2b.

$\endgroup$
18
  • 1
    $\begingroup$ Your last line makes no sense though because anything you type will be 'not' (answer) but only a colon is accepted as 'true' $\endgroup$
    – SlashmanX
    May 19, 2016 at 14:30
  • 1
    $\begingroup$ Your reasoning for the first part makes sense though, whether it's right or not, good stuff $\endgroup$
    – SlashmanX
    May 19, 2016 at 14:35
  • 2
    $\begingroup$ You're trying to make your explanation adapt to an answer, while it should be vice versa. $\endgroup$ May 19, 2016 at 14:42
  • 6
    $\begingroup$ but the semicolon is 59, which is ~196 - it's not just that 3B is "not 2B" $\endgroup$ May 19, 2016 at 15:19
  • 1
    $\begingroup$ @DJMcMayhem Unaccept my answer and instead accept micsthepick answer instead. It is more complete than mine. $\endgroup$
    – Klyzx
    May 20, 2016 at 13:06
1
$\begingroup$

Your computer is developing emotions. The question is 'Do you love me?', and it is offering two choices; A (grade A YES) or a colon (taken to be NO)

$\endgroup$
5
  • $\begingroup$ I think a colon is yes (or True) $\endgroup$
    – Mohit Jain
    May 19, 2016 at 8:42
  • $\begingroup$ @MohitJain; OP has changed the Q since my answer - i was using the medical colon as a metaphor $\endgroup$
    – JMP
    May 19, 2016 at 8:59
  • $\begingroup$ Still the output of the program is same. True of a : $\endgroup$
    – Mohit Jain
    May 19, 2016 at 9:53
  • $\begingroup$ @MohitJain; yes so you are only allowed to enter A or : or the computer will see your response as a lie - they are only binary creatures after all $\endgroup$
    – JMP
    May 19, 2016 at 9:55
  • $\begingroup$ Yes, makes sense. $\endgroup$
    – Mohit Jain
    May 19, 2016 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.