defevaluate(ticketFile): #Evaluates a ticket to check for ireggularities. code_line = None for i,x inenumerate(ticketFile.readlines()): if i == 0: ifnot x.startswith("# Skytrain Inc"): returnFalse continue if i == 1: ifnot x.startswith("## Ticket to "): returnFalse print(f"Destination: {' '.join(x.strip().split(' ')[3:])}") continue
if x.startswith("__Ticket Code:__"): code_line = i+1 continue
if code_line and i == code_line: ifnot x.startswith("**"): returnFalse ticketCode = x.replace("**", "").split("+")[0] ifint(ticketCode) % 7 == 4: validationNumber = eval(x.replace("**", ""))