Solution to problem 11 in Python
This commit is contained in:
parent
4c3960b56e
commit
a8e55eeff4
@ -57,15 +57,16 @@ def rule_1(chars: list[str]) -> bool:
|
||||
|
||||
|
||||
def rule_2(chars: list[str], pos: int) -> list[str]:
|
||||
# not contain the letters i, o, or l
|
||||
# try with next letter
|
||||
a = ord(chars[pos]) + 1
|
||||
# rule # 2
|
||||
# not contain the letters i, o, or l
|
||||
if a in forbidden_chars:
|
||||
a += 1
|
||||
# wraps around to a
|
||||
if a > 122:
|
||||
a = 97
|
||||
chars[pos] = chr(a)
|
||||
# change now previous letter also
|
||||
rule_2(chars, pos - 1)
|
||||
else:
|
||||
chars[pos] = chr(a)
|
||||
|
Loading…
x
Reference in New Issue
Block a user