How do I earn badges?

Badges are given for achievements ,
Baby Turtle - completing the first step.
Green shield - completing the first lesson.
Brown shield - completing the first two lessons.
Red shield - completing the first 4 lessons.
Gold shield - completing the first 8 lessons.
Ninja program - program with more than 50 votes.
Teacher - given for Teachers.
Diligent student - given by the teacher.