I am doing a research essay on the history of programming languages, and I was wondering, why did programmers ever write their programs on punch cards? Didn't computer screens and keyboards already exist by the time programmers used them?

I know they were first invented for the use of the Jacquard loom and to control the desired design, but when people programmed, why did they decide to write their programs on a card oppose to writing it on a terminal?

Was it because since computers were very expensive, not many people had access to them, resulting in people writing programs on punched cards, submitting it to a company or someone or some organization that had one to run them and tell them the result?