Instructions
Play through the game until you complete the Dobby's Plan level in the second school year. Follow the blue arrow to your next class, then successfully complete the class to learn Parseltongue. Follow Draco Malfoy back to the Slytherin common room. If you lose track of him, follow the blue arrow to find him again. A giant snake's head comes out of the wall when you're next to Slytherin's common room door.
Stand in the circle under the snake's head and and press "B" to speak to it. The snake breaks apart into three different sections: a lower third, a middle third and its head. Press "X" to levitate the lower third of the snake over to the purple platform to the left of the Slytherin door. Use the left joystick to control the lower piece of the snake as you levitate it.
Push "X" and use the left joystick to levitate the middle third of the snake so it is positioned on top of the lower third of the snake, then push "X" and use the left joystick to levitate the head of the snake so it's positioned on top of the body to complete the snake. The gate to the Slytherin's common room opens after the snake is reassembled.