Monospaces fonts became so popular in coding because each letter in the fonts takes more places than that of proportional fonts. Programming, in contrast with traditional typography, focuses more on individual characters rather than words or sentences. With the wide space between each character, programmers can recognize bugs easier than locating a specific letter in text with normal typefaces. Moreover, monospaced fonts generally differentiate better between similar characters, such as 0oO, and give more space to important syntactical characters, which make code looks clean.
However, the feature also can be a weakness of the typefaces either. Monospaced typefaces are not good typefaces for body text. Compared to proportional fonts, monospaced fonts are harder to read because of the larger, even spaces between letters. And because they take up more horizontal space, you’ll always get fewer words per page with a monospaced font.