Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
731 B
1
Indexable
Never
def get_largest_bloom_id(input_prefix):
    with open("blooms.txt", "r") as file:
        matched_bloom_id = []
        next(file)
        recorded_bloom_prefix = ""
        for line in file:
            recorded_bloom_id = line.split(",")[0]
            
            if len(input_prefix) == 4:
                recorded_bloom_prefix = line.split(",")[0].strip()[0]
            elif len(input_prefix) == 5:
                recorded_bloom_prefix = line.split(",")[0].strip()[:2]

            if input_prefix == recorded_bloom_prefix:
                matched_bloom_id.append(recorded_bloom_id)

        print(matched_bloom_id)
        largest_bloom_id = max(matched_bloom_id)
        return largest_bloom_id

get_largest_bloom_id("R")