summaryrefslogtreecommitdiffstats
path: root/11/solution_own.py
diff options
context:
space:
mode:
Diffstat (limited to '11/solution_own.py')
-rw-r--r--11/solution_own.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/11/solution_own.py b/11/solution_own.py
new file mode 100644
index 0000000..0c45bc0
--- /dev/null
+++ b/11/solution_own.py
@@ -0,0 +1,18 @@
+def valid(p: str) -> bool:
+ if {'i', 'o', 'l'}.intersection(set(p)):
+ return False
+
+def next_password(p: str) -> str:
+ if p[-1] == 'z':
+ return next_password(p[:-1]) + 'a'
+ else:
+ return p[:-1] + chr(ord(p[-1]) + 1)
+
+pw = next_password('cqjxjnds')
+while not valid(pw):
+ pw = next_password(pw)
+print(pw)
+pw = next_password(pw)
+while not valid(pw):
+ pw = next_password(pw)
+print(pw)