Python SolutionsPython Solutions
🕵️
The Secret Order
Week 3, 2026
All Solutionspython brute force approach | BMC | Python Solutions
# bmc's ideas below ---
# checking if each word is in ALPHABETICAL ORDER or not.
# since all of the BLUE words are, I decided to do the following:
# ALSO, we see that 'A' is NOT VALID but 'AAA' is valid. Which made me think that maybe the minimum length is 2?
# yeah and I did that and it worked, gamer god
def is_valid(word):
if len(word) < 2: return False
word_lower = word.lower()
sorted_version = ''.join(sorted(word_lower))
return sorted_version == word_lower
with open('words.txt', 'r') as f:
words = [line.strip().lower() for line in f if line.strip()]
valid_words = []
for word in words:
if is_valid(word):
valid_words.append(word)
with open('valid_words.txt', 'w') as f:
for word in valid_words:
f.write(word + '\n')
print(f"Found {len(valid_words)} valid words out of {len(words)}")
Python function & Procedure approach | rud | Python Solutions
def read_file(filename: str) -> list[str]:
try:
with open(filename, "r") as file:
return file.read().strip().split()
except IOError:
raise IOError(f"File {filename} could not be found")
def is_abecedarian(word: str) -> bool:
return list(word) == sorted(list(word))
def save_file(filename: str, words: list[str]) -> None:
with open(filename, 'w', encoding='utf-8') as file:
file.writelines(word + '\n' for word in words)
#Driver Code
words: list[str] = read_file("words.txt")
accepted_words = [word for word in words if is_abecedarian(word) and len(word) > 1]
save_file("answer.txt", accepted_words)
Python function based approach | THOMAS L | Python Solutions
//Paste your solution here if you want to share it publ
def PrintWord(word: str):
prev = ord('a') - 1
for c in word.strip(" ").lower():
binary = ord(c)
if binary < prev:
return
prev = binary
if len(word) > 1:
print(word)
fileName = input()
with open(fileName, "r") as f:
content = f.read()
words = content.splitlines()
for word in words:
PrintWord(word)
python | Peiran D | Python Solutions
//Paste your solution here if you want to share it publiclywith open("word_list.txt", "r") as file:
for line in file:
word = line.strip()
if word:
w = word.lower()
is_ascending = True
for i in range(len(w) - 1):
if w[i] > w[i + 1]:
is_ascending = False
break
if is_ascending:
print(word)
Python easy solution | MushyZ | Python Solutions
# Function to check Abecedarian property
def is_abecedarian(word):
word = word.lower()
return len(word) > 1 and all(word[i] <= word[i+1] for i in range(len(word)-1))
# Read English words
with open("breakfun/english_words.txt", "r") as f:
words = [line.strip() for line in f if line.strip()]
# Filter Abecedarian words
abecedarian_words = [word for word in words if is_abecedarian(word)]
# Save to file, one word per line
with open("breakfun/abecedarian_words.txt", "w") as f:
for word in abecedarian_words:
f.write(word + "\n")
print(f"{len(abecedarian_words)} Abecedarian words found")