Currently I'm working on a new category of levels based around breaking ciphers and brute-forcing passwords. Here is a sneak preview into one of them.
What's my PIN again?
You forgot the code for your safe (of course it's your safe, you wouldn't want to open someone else's safe, right? Right?). All you remember is it was 3 digits. That's 1000 possible solutions. Easy but not exactly fun to try out all combinations by hand. A simple brute-force script can automate that and open the lock in a couple of seconds (because you are limited in the number of combinations you can enter per second). However, meet the miracle PinHacker device:

It can tell you if the pin you entered is greater than or less than the true pin. Could you come up with a more efficient search strategy using this information?
Python Tips and Tricks
The seemingly simple "+" operator has quite a lot of different uses in Python:
- Add numeric values
x = 5 +3 - Concatenate strings
print("x is: " + str(x)) - Merge lists
long_list = [1,2,3] + [4,5,6]
This is done using a principle called operator overloading.
Quiz Time
There are many possible solutions to the previous quiz. One way to simplify the code is to drop the len>0 expression. my_name = "max"
my_age = 38
if my_age>=0 and my_name:
print("hello there")
else:
print("invalid")
Now for today's quiz, what's the output of this code (please use the [spoiler] tag for your answer)?def clamp(x,a,b):
if x < a:
return a
if x > b:
return b
return x
a = 15 / 2
a = clamp(a,0,5)
print(a)
