In music, if you double (or halve) the pitch of any note you will get to the same note again.

"Concert A" is fixed at 440 Hz, and every other note is defined based on that. 880 Hz is also an A, as is 1760 Hz, as is 220 Hz.

There are 12 notes in Western music: A, A#, B, C, C#, D, D#, E, F, F#, G, G#. You are given a preloaded dictionary with these 12 notes and one of the pitches that creates that note (starting at Concert A).

Now, given a pitch (in Hz), return the corresponding note. (All inputs will be valid notes).

For reference, the notes dictionary looks like this:

```python
notes_dictionary = {
    440: "A",
    466.16: "A#",
    493.88: "B",
    523.25: "C",
    554.37: "C#", 
    587.33: "D", 
    622.25: "D#", 
    659.25: "E", 
    698.46: "F", 
    739.99: "F#", 
    783.99: "G", 
    830.61: "G#"
}
```

Musicians: all pitches based on equal tempermanent, taken from [here](http://pages.mtu.edu/~suits/notefreqs.html).

Difficulty: introductory

Starter code:

def get_note(pitch):
	

Solutions:
notes = {
440: "A",
466.16: "A#",
493.88: "B",
523.25: "C",
554.37: "C#",
587.33: "D",
622.25: "D#",
659.25: "E",
698.46: "F",
739.99: "F#",
783.99: "G",
830.61: "G#"
}

def get_note(pitch):

    for note in notes:
        if note >= pitch and note % pitch == 0:
                return notes[note]
        elif note < pitch and pitch % note == 0:
                return notes[note]

N="A A# B C C# D D# E F # F# G G#".split()
get_note=g=lambda n:12<n//1<27and N[int(n)-13]or g(n/2)

from math import log2

ns=["A","A#","B","C","C#","D","D#","E","F","F#","G","G#"]

def get_note(p):
    return ns[round(log2(p/55)*12)%12]

notesDictionary = {
440: "A",
466.16: "A#",
493.88: "B",
523.25: "C",
554.37: "C#", 
587.33: "D", 
622.25: "D#", 
659.25: "E", 
698.46: "F", 
739.99: "F#", 
783.99: "G", 
830.61: "G#"
}
def get_note(pitch):
    for key, value in notesDictionary.items():
        if max(pitch, key) % min(pitch, key) == 0:
            return value

notesDictionary = {
    440: "A",
    466.16: "A#",
    493.88: "B",
    523.25: "C",
    554.37: "C#", 
    587.33: "D", 
    622.25: "D#", 
    659.25: "E", 
    698.46: "F", 
    739.99: "F#", 
    783.99: "G", 
    830.61: "G#"
}

def adjust_pitch(pitch):
    if pitch in notesDictionary:
        return pitch
    elif pitch<440:
        while pitch not in notesDictionary:
            pitch *= 2
        return pitch
    elif pitch>830:
        while pitch not in notesDictionary:
            pitch = pitch / 2
        return pitch
    else:
        # shouldn't happen
        return -1

def get_note(pitch):
    return notesDictionary[adjust_pitch(pitch)]