We would study BASIC from manuals and other books, and pour over program listings in magazines. Then we would write out programs on paper, and "interpret" them in our heads to see if they worked correctly.
Some home computers like the Timex / Sinclair were relatively inexpensive ($100 USD in 1981, $330 in today's dollars), they weren't cheap even then, and that was the very lowest-end device possible (4Kbytes RAM, no storage whatsoever). An Apple II with a floppy drive and montior would run into the thousands of dollars back then.