Deep Thought

“All right,” said the computer, and settled into silence again. The two men fidgeted. The tension was unbearable.
“You’re really not going to like it,” observed Deep Thought.
“Tell us!”
“All right,” said Deep Thought. “The Answer to the Great Question…”
“Of Life, the Universe and Everything…” said Deep Thought.
“Is…” said Deep Thought, and paused.
“Forty-two,” said Deep Thought, with infinite majesty and calm.”

The Hitchhiker’s Guide to the Galaxy, Douglas Adams

In, implement a program that prompts the user for the answer to the Great Question of Life, the Universe and Everything, outputting Yes if the user inputs 42 or (case-insensitively) forty-two or forty two. Otherwise output No.

  • No need to convert the user’s input to an int if you check for equality with "42", a str, rather than 42, an int!
  • It’s okay if your output or the user’s wraps onto multiple lines.


Before You Begin

Log into, click on your terminal window, and execute cd by itself. You should find that your terminal window’s prompt resembles the below:


Next execute

mkdir deep

to make a folder called deep in your codespace.

Then execute

cd deep

to change directories into that folder. You should now see your terminal prompt as deep/ $. You can now execute


to make a file called where you’ll write your program.

How to Test

Here’s how to test your code manually:

  • Run your program with python Type 42 and press Enter. Your program should output:
  • Run your program with python Type Forty Two and press Enter. Your program should output:
  • Run your program with python Type forty-two and press Enter. Your program should output
  • Run your program with python Type 50 and press Enter. Your program should output

Be sure to vary the casing of your input and “accidentally” add spaces on either side of your input before pressing enter. Your program should behave as expected, case- and space-insensitively.

You can execute the below to check your code using check50, a program that CS50 will use to test your code when you submit. But be sure to test it yourself as well!

check50 cs50/problems/2022/python/deep

Green smilies mean your program has passed a test! Red frownies will indicate your program output something unexpected. Visit the URL that check50 outputs to see the input check50 handed to your program, what output it expected, and what output your program actually gave.

How to Submit

In your terminal, execute the below to submit your work.

submit50 cs50/problems/2022/python/deep