I've got a dictionary with integer keys and list values. I want to be able to iterate through the list and if I find an entry that matches my input I want to print/store the two items before the specified, the specified, and the two items after, thus storing a new list of five. I am wanting this to wrap around so that if the match were the last in the list it would get the last three of the list and the first two in the list. I can't figure it out.
strings = {1:['e','f','fsharp','g','gsharp','a','asharp','b','c','csharp','d','dsharp'],
2:['a','asharp','b','c','csharp','d','dsharp','e','f','fsharp','g','gsharp'],
3:['d','dsharp','e','f','fsharp','g','gsharp','a','asharp','b','c','csharp'],
4:['g','gsharp','a','asharp','b','c','csharp','d','dsharp','e','f','fsharp'],
5:['b','c','csharp','d','dsharp','e','f','fsharp','g','gsharp','a','asharp'],
6:['e','f','fsharp','g','gsharp','a','asharp','b','c','csharp','d','dsharp']}
usr_note = input("Enter note: ")
surrounding_notes = strings[1][strings[1].index(usr_note)-2:strings[1].index(usr_note)+2]