How do computers read lines of code?

Of course it depends.

Interpreted languages

Python, PHP

These languages read your code on the fly, executing the code with an interpreter.

Compiled languages

C++, Rust, Swift

These languages turn source code into native machine code by a compiler.

Bytecode

Java, Python pyc

These languages compile source code into bytecode, which are then interpreted.