-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday4-1.py
More file actions
36 lines (31 loc) · 868 Bytes
/
Copy pathday4-1.py
File metadata and controls
36 lines (31 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
#input function for both python2.7 and 3
def getInput(prompt=''):
try:
line = raw_input(prompt)
except NameError:
line = input(prompt)
return line
print('Enter/paste content. Ctrl-D to save. ', end='')
pw_list = []
while True:
try:
line = getInput()
except EOFError:
break
pw_list.append(line)
ok_passphrases = 0
for line in pw_list:
this_row = line.split()
last_word = len(this_row) - 1
current_word = 0
for word in this_row:
if this_row.count(word) != 1:
continue
elif current_word != last_word:
current_word += 1
elif current_word == last_word:
ok_passphrases += 1
print("acceptable passphrases: ", ok_passphrases)