Typing Course

Feedback
Settings
AccuracySpeedTimeErrors

100%

0WPM

0CPM

0s

0/0

"""⏎
Psuedo Code: http://en.wikipedia.org/wiki/Binary_search⏎
"""⏎
def search(seq, key):⏎
"""⏎
Takes a list of integers and searches if the `key` is contained within⏎
the list.⏎
:param seq: A list of integers⏎
:param key: The integer to be searched for⏎
:rtype: The index of where the `key` is located in the list. If `key` is⏎
not found then False is returned.⏎
"""⏎
lo = 0⏎
hi = len(seq) - 1⏎
while hi >= lo:⏎
mid = lo + (hi - lo) // 2⏎
if seq[mid] < key:⏎
lo = mid + 1⏎
elif seq[mid] > key:⏎
hi = mid - 1⏎
else:⏎
return mid⏎
return False⏎
`~
1!
2@
3#
4$
5%
6^
7&
8*
9(
0)
-_
=+
backspace
tab
q
w
e
r
t
y
u
i
o
p
[{
]}
\|
capslock
a
s
d
f
g
h
j
k
l
;:
'"
enter
lshift
z
x
c
v
b
n
m
,<
.>
/?
rshift
fn
ctrl
lalt
lmeta
space
rmeta
ralt