Have you ever thought about how traffic lights know when to change from green to yellow to red? This video goes into Python programming and shows how a few lines of code can control things in the real world.
You'll see that when you follow step-by-step instructions, machines do exactly what you want them to do.