Tutorial¶
This demonstrates how to use the DeepThought
class to deal with your personal philosophical issues.
Initial steps¶
First, let us import the what we need.
[1]:
import sys
sys.path.append('../src')
from features import computer
We will be using an instance of the special computer named DeepThought
[2]:
thinker = computer.DeepThought()
Finding the answer¶
The answer for “Ultimate Question of Life, the Universe, and Everything” can be easily computed.
[3]:
thinker.get_the_answer()
[3]:
42
Finding the question¶
The frustrating thing about finding the answer to “Ultimate Question of Life, the Universe, and Everything” is that “the Question” is actually a harder problem.
For those in a hurry¶
If you don’t too much time in your hands, you can get away with “a question” (which may or may not be the right one). This can be done using the following method:
[4]:
thinker.get_a_question()
[4]:
'What do you get if you multiply six by nine?'
Note that this may change if re-executed… therefore, we added the tag: ``nbval-ignore-output`` to it
[5]:
thinker.get_a_question()
[5]:
'How many roads must a man walk down?'
For those with time¶
You may want to execute the following command to get a definite answer…
[6]:
thinker.get_the_question()
This may take some time...
...
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-6-8fb74e69032b> in <module>
----> 1 thinker.get_the_question()
~/notebooks-for-docs-and-tests-demo/src/features/computer.py in get_the_question(self)
52 print('This may take some time...')
53 print('...')
---> 54 time.sleep(10)
55
56 return thingy.something
KeyboardInterrupt:
The above execution was interrupted due to the demo’s time constraints.
To to prevent it from entering the validation, we added the tag ``nbval-skip`` to it.