{
  "id": 12884734,
  "title": "Python Loops at the Nairobi Animal Orphanage",
  "url": "https://urgent.news/2026/10/08/python-loops-at-the-nairobi-animal-orphanage",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-08T14:10:01.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/david_mwandairo/python-loops-at-the-nairobi-animal-orphanage-1fkn"
  },
  "original_language": "en",
  "account": "The Nairobi Animal Orphanage, located within the boundaries of Nairobi, is home to various animals and provides care to orphaned, injured, and abandoned creatures. Rangers and staff at the orphanage perform tasks such as counting the number of strokes added to a reservoir and checking water bowls for individual enclosures.\n\nPython, a programming language, can assist with such repetitive tasks using loops. A for loop iterates through a collection of items, executing a block of code for each item. This is useful when working with a list of numbers or a string. For instance, a for loop can count the number of pump strokes required to fill a cheetah trough or check the water bowls of six labeled pens.\n\nA while loop, on the other hand, is used when the number of iterations is unknown in advance. It continues executing a block of code as long as a certain condition remains true. An example of a while loop is the brooder script, which heats a chick's enclosure until the desired temperature is reached. The loop continues until the temperature surpasses the target value, but if the temperature never increases, the loop will run indefinitely.\n\nWhen deciding between a for loop and a while loop, consider whether you have a predetermined set of items or a goal to achieve. For loops are more straightforward to use when there is a defined sequence, while while loops are better suited for situations where the number of iterations depends on a specific condition. Remember to include a mechanism that alters the loop's condition within the loop's block, preventing endless execution.",
  "summary": "Nairobi is one of the few capitals with a national park inside its limits. Lions hunt on the plains while the city skyline stands in view. Near the Main Gate on Lang'ata Road, the Kenya Wildlife Service runs the Nairobi Animal Orphanage, which takes in orphaned, injured and abandoned animals, treats them, and gives them a chance to return to the wild. Now picture a day on the job. The park gates…",
  "key_points": [
    "Python loops assist with repetitive tasks at Nairobi Animal Orphanage",
    "For loop iterates through collections for tasks like counting pump strokes",
    "While loop continues until condition is met, like heating chick enclosure"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}