-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3.py
More file actions
29 lines (24 loc) · 859 Bytes
/
Copy path3.py
File metadata and controls
29 lines (24 loc) · 859 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
# Open the file with the encoded message and make it into a string
file = open('3.txt')
messy_string = file.read()
file.close()
# Create two separate alphabets for matching
small = "abcdefghijklmnopqrstuvwxyz"
cap = small.upper()
# Look at each letter, if the three before, and three after, are capital letters
# Skip the first and last three
max_index = len(messy_string)-6
found_matches = ""
for index in range(max_index):
if messy_string[index] in small:
if messy_string[index-1] in cap:
if messy_string[index-2] in cap:
if messy_string[index-3] in cap:
if messy_string[index-4] in small:
if messy_string[index+1] in cap:
if messy_string[index+2] in cap:
if messy_string[index+3] in cap:
if messy_string[index+4] in small:
found_matches += (messy_string[index])
print(found_matches)
print("done")