0% found this document useful (0 votes)
9 views4 pages

Count Breaches in Log Entries

Coding questipn in py

Uploaded by

Aryan Dhiman
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views4 pages

Count Breaches in Log Entries

Coding questipn in py

Uploaded by

Aryan Dhiman
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

def findBreachCount(logs: str) -> int:

# Split the logs by the delimiter ';'

log_entries = [Link](';')

# Initialize the breach count

breach_count = 0

# Iterate through each log entry

for entry in log_entries:

# Convert the entry to lowercase

entry_lower = [Link]()

# Check if 'breach' is in the entry

if 'breach' in entry_lower:

breach_count += 1

return breach_count

# Example usage:
logs = "breach brEach; Breach; ; some other log; BREACH happened again"

print(findBreachCount(logs)) # Output: 3

You might also like