@@ -0,0 +1,1503 @@
+%22%22%22Module to find real rooms in data and sum their sector IDs.%22%22%22%0A%0A%0Adef main():%0A    %22%22%22Run the main function.%22%22%22%0A    with open('data/day4data.txt', 'r') as f:%0A        dataList = f.readlines()%0A%0A    realRoomList = %5B%5D%0A    roomNames = %5B%5D%0A    sum = 0%0A%0A    for line in dataList:%0A        data = line.strip(%22%5Cn%22).split('-')%0A        name = '-'.join(data%5B:-1%5D)%0A        id, checkSum = data%5B-1%5D.strip('%5D').split('%5B')%0A%0A        nameCheck = %7B%7D%0A%0A        check = %5Bitem for sublist in name.split('-') for item in sublist%5D%0A%0A        for i in check:%0A%0A            if i not in nameCheck.keys():%0A                nameCheck%5Bi%5D = 1%0A            else:%0A                nameCheck%5Bi%5D += 1%0A        nameCheck = sorted(nameCheck.iteritems(), key=lambda x: x%5B0%5D)%0A        nameCheck = sorted(nameCheck, key=lambda x: x%5B1%5D, reverse=True)%0A        nameCheck = %5Bi%5B0%5D for i in nameCheck%5D%0A        if ''.join(nameCheck%5B0:len(checkSum)%5D) == checkSum:%0A            realRoomList.append((name, id))%0A%0A    for room in realRoomList:%0A        encriptedName = room%5B0%5D%0A        decriptedName = %5B%5D%0A        for i in encriptedName:%0A            decriptedName.append(decriptLetter(i, room%5B1%5D))%0A        sum += int(room%5B1%5D)%0A        roomNames.append(%5B''.join(decriptedName), room%5B1%5D%5D)%0A    for i in roomNames:%0A        print('%7B%7D').format(i)%0A    print(sum)%0A%0A%0Adef decriptLetter(c, shift):%0A    %22%22%22Decript a letter using the shift cipher.%22%22%22%0A    if c == '-':%0A        return ' '%0A    return chr((((ord(c) - 97) + int(shift)) %25 26) + 97)%0A%0A%0Aif __name__ == '__main__':%0A    main()%0A

Add day 4 part 2.