In [1]:
from challenge import checkAnswer

In [3]:
checkAnswer('this_was_a_bad_idea_from_thestart')


Out[3]:
True

In [3]:
with open('/usr/share/dict/words') as fobj:
    words = fobj.read().split()

In [4]:
for word in words:
    if checkAnswer(word):
        print(word)

In [88]:
passw = 'this_was_a_bad_idea_from_the'
i = passw.split('_')

In [89]:
len(passw) != 33


Out[89]:
True

In [90]:
i[0] = [ord(char) - 96 for char in i[0]]

i


Out[90]:
[[20, 8, 9, 19], 'was', 'a', 'bad', 'idea', 'from', 'the', 'start']

In [91]:
ord('a') - 96


Out[91]:
1

In [92]:
import string

for l in string.ascii_letters:
    x = ord(l) - 96
    if x == 20:
        print(l, 20)
    if x == 8:
        print(l, 8)
    if x == 9:
        print(l, 9)
    if x == 19:
        print(l, 19)


('h', 8)
('i', 9)
('s', 19)
('t', 20)

In [93]:
if not i[0] == [20, 8, 9, 19]:
    print(False)

In [94]:
import base64
base64.b64encode(bytes(i[1]))

if base64.b64encode(bytes(i[1])) != 'd2Fz':
    print(False)

In [95]:
if int((' '.join(format(ord(x), 'b') for x in i[2]))) != 1100001:
    print(False)

In [96]:
n[3].split('a')[0] != 'b'
n[3].split('a')[1] != 'd'


Out[96]:
False

In [97]:
if not n[3].split('a')[0] != 'b' and n[3].split('a')[1] != 'd':
    print(False)

In [98]:
print('69'.decode("hex"))
print('646561'.decode('hex'))


i
dea

In [99]:
if int(n[4][0].encode('hex')) != 69 and int(n[4][1:].encode('hex')) != 646561:
    print(False)

In [100]:
n[5].startswith('fr')
int(n[5]) < 1
int(n[5]) != 0
n[5].endswith('m')


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-100-f0e9bf6f4a54> in <module>()
      2 
      3 n[5].startswith('fr')
----> 4 int(n[5]) < 1
      5 int(n[5]) != 0
      6 n[5].endswith('m')

ValueError: invalid literal for int() with base 10: 'from'

In [101]:
if not n[5].startswith('fr') and not int(n[5]) < 1 and not int(n[5]) != 0 and not n[5].endswith('m'):
    print(False)

In [102]:
if not n[6].encode('rot13')[0] == 'g' and n[6].encode('rot13')[1:] != 'urfgneg':
    print(False)

In [103]:
u = n

if u.count('_') > 6 and not u.count('_') == 5:
    print(False)

In [10]:
passw = 'this_was_a_bad_idea_from_the_star'
i = passw.split('_')
i


Out[10]:
['this', 'was', 'a', 'bad', 'idea', 'from', 'the', 'star']

In [11]:
print(len(passw))

if len(passw) != 33:
    print(False)


33

In [12]:
i[0] = [ord(char) - 96 for char in i[0]]

if not i[0] == [20, 8, 9, 19]:
    print(False)

if base64.b64encode(bytes(i[1])) != 'd2Fz':
    print(False)

if int((' '.join(format(ord(x), 'b') for x in i[2]))) != 1100001:
    print(False)

In [13]:
n = i

if not n[3].split('a')[0] != 'b' and n[3].split('a')[1] != 'd':
    print False

if int(n[4][0].encode('hex')) != 69 and int(n[4][1:].encode('hex')) != 646561:
    print False

In [14]:
n = i

if not n[5].startswith('fr') and not int(n[5]) < 1 and not int(n[5]) != 0 and not n[5].endswith('m'):
    print False

if not n[6].encode('rot13')[0] == 'g' and n[6].encode('rot13')[1:] != 'urfgneg':
    print False

In [15]:
u = n

if u.count('_') > 6 and not u.count('_') == 5:
    print False

In [16]:
checkAnswer(passw)


Out[16]:
True

In [ ]: