Skip to content

Commit 88cc089

Browse files
committed
fix directives
1 parent e043f15 commit 88cc089

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

challenges/binary_search.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A search problem
88

99
Suppose you have a list of 1 million numbers:
1010

11-
.. code:: python3
11+
.. code:: python
1212
1313
from random import randint, seed
1414
@@ -25,7 +25,7 @@ Brute-force solution
2525

2626
Of course, you could loop through all the numbers:
2727

28-
.. code:: python3
28+
.. code:: python
2929
3030
def search(query, ids):
3131
"""brute-force search"""
@@ -47,7 +47,7 @@ Recursive solution
4747
An alternative approach is **binary search**, one of the most
4848
fundamental recursive algorithms:
4949

50-
.. code:: python3
50+
.. code:: python
5151
5252
def binary_search(query, ids, start, stop):
5353
"""recursive binary search"""
@@ -84,9 +84,9 @@ Challenge
8484
Measure the time it takes both algorithms to run on 1 million numbers.
8585
In IPython/Jupyter, you can use the magic function ``%time``:
8686

87-
.. code:: ipython3
87+
.. code:: python
8888
89-
In [2]: %time search(8997173, ids)
89+
%time search(8997173, ids)
9090
9191
Compare the time required by the brute-force and binary implementations.
9292
Then increase the size of the data by factor 10 and repeat the

conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
]
2424

2525
templates_path = ['_templates']
26-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.md']
26+
exclude_patterns = ['.venv', '.claude',
27+
'_build', 'Thumbs.db',
28+
'.DS_Store', 'README.md']
2729

2830
language = 'en'
2931

performance/profiling.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Inspect the output and look for bottlenecks.
1515

1616
Then insert the line:
1717

18-
.. code:: python3
18+
.. code:: python
1919
2020
z[index] = z[index] \*\* 2 + c[index]
2121
@@ -25,7 +25,7 @@ Re-run the profiling.
2525

2626
cProfile also works inside a program:
2727

28-
.. code:: python3
28+
.. code:: python
2929
3030
import cProfile
3131
cProfile.run("[x for x in range(1500)]")
@@ -35,13 +35,13 @@ Timing in Jupyter / IPython
3535

3636
IPython (including Jupyter notebooks) has two magic commands for measuring execution time.
3737

38-
.. code:: ipython3
38+
.. code:: python
3939
4040
%time len(range(100000))
4141
4242
compare the output to
4343

44-
.. code:: ipython3
44+
.. code:: python
4545
4646
%timeit
4747

0 commit comments

Comments
 (0)