"""
Find one string of characters that is not present in the list. You are provided a function
that loads the strings from the provided file, `sequences.txt`.
You may not use any libraries that assist you in completing this solution.
This specifically includes the `random` and `string` library.
Your function must return two values: the string not present in the list, and a boolean value
representing if the value is present in the list. Ensure to use documentation strings and comments
to explain your program! Good luck!
@professor XXXXXXXX
@class CS 1350
@due Nov 15, 2021
Provide your details below:
@author Ben Antonellis
@date Nov 2nd, 2021
"""
# PROVIDED FUNCTIONS #
def load_sequences():
sequences = []
with open('sequences.txt', 'r') as input_file:
for line in input_file:
sequences.append(line.strip())
return sequences
# PROVIDE YOUR SOLUTION BELOW #
from typing import Tuple # For code clarity
def find_excluded() -> Tuple[str, bool]:
"""
This algorithm marches through each string in the list, and for every string
flips the n-th character. By doing this, this ensures the string is different
from each string by at least one character.
"""
strings = load_sequences()
string_index = 0
result = ""
for idx, _ in enumerate(strings):
result += "A" if strings[idx][string_index] == "B" else "B"
string_index += 1
return result, result in strings
result, should_be_false = find_excluded()
print(result)
print(should_be_false)