class Note(object):
    def __init__(self, pitch, octave, accidental=None):
        self.pitch = pitch.upper()
        self.octave = octave
        self.accidental = accidental

        if accidental is not None:
            self.accidental = self.accidental.lower()

    @classmethod
    def from_note_string(cls, note_string):
        pitch = note_string[0]
        octave = note_string[1]
        accidental = note_string[2:]

        if len(accidental) == 0:
            accidental = None

        return cls(pitch, octave, accidental)

    def __str__(self):
        s = self.pitch + str(self.octave)
        if self.accidental is not None:
            s += self.accidental
        
        return s


if __name__ == '__main__':
    n = Note('A', 4, accidental='b')
    print(n)

    n = Note.from_note_string('A4#')
    print(n)
@@ -21,59 +21,1249 @@
     
-def __init__(self, pitch, octave, accidental=None):
+VALID_PITCHES = ('C', 'D', 'E', 'F', 'G', 'A', 'B')%0A    VALID_ACCIDENTALS = ('#', '##', 'b', 'bb')%0A%0A    def __init__(self, pitch, octave, accidental=None):%0A        if not isinstance(pitch, str):%0A            raise ValueError('Expected string for pitch - (provided ' + str(pitch) + ')')%0A        if pitch.upper() not in Note.VALID_PITCHES:%0A            raise ValueError('Invalid pitch: ' + str(pitch))%0A%0A        try:%0A            int(octave) # test if octave value is a number%0A        except:%0A            raise ValueError('Expected integer for octave - (provided ' + str(octave) + ')')%0A        if '.' in str(octave): # check that the number doesn't have a decimal place%0A            raise ValueError('Expected integer for octave - (provided ' + str(octave) + ')')%0A        if (int(octave) %3C -1) or (int(octave) %3E 9):%0A            raise ValueError('Octave needs to be in the range %5B-1, 9%5D - (provided ' + str(octave) + ')')%0A%0A        if accidental is not None:%0A            if not isinstance(accidental, str):%0A                raise ValueError('Expected string for accidental - provided ' + str(accidental) + ')')%0A            if accidental.lower() not in Note.VALID_ACCIDENTALS:%0A                raise ValueError('Invalid accidental: ' + str(accidental))%0A
 %0A   
@@ -1316,22 +1316,27 @@
 ctave = 
+int(
 octave
+)
 %0A       

Add validation to Note class.