variables, basic data types (integers, floating point numbers, strings, booleans), control (conditional statements and loops)
These are core programming concepts that are integral to any language.
Consider using the apply first, study second approach with the resources below: try a problem or exercise from the Apply It section first. If you get stuck, then use a course, book, or lecture in the Reference section. Or if you’re completely new to a topic, then learn just enough and apply right away. The point is: the quicker you get to the “doing,” the better the learning. Make your learning active.
Exercises for Programmers by Brian Hogan is an electronic book filled with practical, real-world exercises that are organized by topic. I mention this book several times throughout the Pyramid, and for good reasons.
"The man on top of the mountain didn't fall there."
First, it covers several core programming topics, three of which are relevant to our purposes in this section of the Pyramid: working with basic data types and control flow (see chapters 2, 3, 4, and 6). Second, the included problems are like an onion: you can solve the same one over and over again and gain new insights each time. That’s because Hogan offers several challenges and constraints for each one. This book is a good place to start to gain familiarity and confidence with basic language constructs.
Koans is a free interactive tutorial that’ll get you familiar with core aspects of the language of your choice. The idea is to learn a language by getting the provided tests to pass. Select a language, then follow the directions in the “README” file to get started. This resource is a great way to get practice with a language and its essential building blocks.
Reuven Lerner’s book, Python Workout, is another source I refer to several times throughout the Pyramid. For our purposes right now, focus on chapters 1 and 2, which cover numeric types and strings.
After a brief introduction to a topic, Lerner gives you a problem to solve. However, a point of distinction are the solutions he provides. You get far more than an answer; you get a detailed explanation of why Lerner solved the problem the way he did. He provides video links to short screencasts so you can see him solve the problem, as he shares his thought process along the way. For me, this is the highlight.
Tip: If you’re newer to programming, first start with Hogan’s book, Exercises for Programmers. Then, move on to Lerner’s book, Python Workout, followed by the CS 61A problem set explained below.
Stretch your knowledge of control with Lab 1: Variables & Functions, Control from the Berkeley course CS 61A: Structure and Interpretation of Computer Programs. It consists of two parts: command-line exercises and code-writing problems. I recommend doing both: they’re quality exercises and problems and they’re free! This short video will show you how to access the files and run the tests for Lab 1.
This write up from Berkeley’s CS 61A course offers a nice summary of control. I’ve linked directly to the section that you’ll want to reference, which covers boolean operators, if statements, and while loops.
Learn X in Y minutes is a useful (and free) website to keep handy as a general reference for a language. Select the language of your choice from the homepage. Then, you’ll get a comprehensive write up of core aspects and features of that language, and how they work. The write up for each language is extensive. You’ll find many of the topics addressed in this section of the Pyramid (eg, variables, booleans, and control flow). Just search for the specific topic you need (i.e. “ctrl-f” and type “boolean,” for example).
Hyperpolyglot offers similar information as you’ll find in Learn X in Y minutes; it’s also free. Select the language of your choice from the homepage. Note that the languages are grouped together. For example, if you’re looking for Python, you’d click Node.js, PHP, Python, Ruby.
Then, search for the specific topic you’re looking for, such as “execution control” (i.e. control find (“ctrl f”) “execution control”). You’ll get a nice summary of “execution control” for Python, as well as the other languages in the group in a side-by-side comparison.
Take a deeper dive into control by reading section 1.5 in the free electronic book, Composing Programs by John DeNero, who’s also authored video lectures in the Berkeley course CS 61A that covers many topics within Language Constructs. You may also find this short lecture on strings helpful.