<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Fidel Okumu</title>
    <description>The latest articles on DEV Community by Fidel Okumu (@fidel_okumu).</description>
    <link>https://dev.to/fidel_okumu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4009368%2F35d99d7c-fb31-43ed-82b0-6e897da85c1e.png</url>
      <title>DEV Community: Fidel Okumu</title>
      <link>https://dev.to/fidel_okumu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fidel_okumu"/>
    <language>en</language>
    <item>
      <title>Loops: Repeating Work Without Repeating Code</title>
      <dc:creator>Fidel Okumu</dc:creator>
      <pubDate>Tue, 08 Sep 2026 12:51:33 +0000</pubDate>
      <link>https://dev.to/fidel_okumu/loops-repeating-work-without-repeating-code-2lda</link>
      <guid>https://dev.to/fidel_okumu/loops-repeating-work-without-repeating-code-2lda</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Introduction&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
A huge part of programming is doing the same action many times — checking every driver in a list, processing every row of data, or repeating a task until a condition is met. Loops are how Python handles this without forcing me to copypaste the same line over and over.&lt;br&gt;
&lt;strong&gt;For Loops&lt;/strong&gt;&lt;br&gt;
A for loop runs a block of code once for every item in a collection.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkvkzyc7d852pt14qb8uk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkvkzyc7d852pt14qb8uk.png" alt=" " width="748" height="200"&gt;&lt;/a&gt;&lt;br&gt;
What I understood here: driver is a temporary variable that takes on each value in drivers, one at a time in order. The loop runs exactly as many times as there are items in the list four times, in this case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;While Loops&lt;/strong&gt;&lt;br&gt;
A while loop repeats until a condition becomes false, rather than looping over a fixed collection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbymf8jf7s8pakfp2an9m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbymf8jf7s8pakfp2an9m.png" alt=" " width="798" height="87"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The detail that took the most getting used to: the condition is checked before every round, and the loop starts counting from 0. So while rides_completed &amp;lt; 3 actually runs 3 times (for 0, 1, 2), not what I initially assumed. Forgetting the += 1 line entirely would make the condition stay true forever, causing an infinite loop — one of the most common mistakes with while loops.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Break and Continue&lt;/strong&gt;&lt;br&gt;
These give more control over a loop's execution:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzgjrm8bk6l4505sgb5qu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzgjrm8bk6l4505sgb5qu.png" alt=" " width="799" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The distinction: break exits the loop immediately and nothing after it runs, not even for remaining items. continue only skips the current round the loop still checks every other item normally.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enumerate()&lt;/strong&gt;&lt;br&gt;
Sometimes I need both the item and its position in the list. Enumerate() provides both at once:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzbw82octoh61mybqd4m7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzbw82octoh61mybqd4m7.png" alt=" " width="712" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I Learned&lt;/strong&gt;&lt;br&gt;
I learned that loops allow Python to repeat instructions automatically until a certain condition is met or until all items have been processed. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>coding</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Functions: Writing Reusable Code</title>
      <dc:creator>Fidel Okumu</dc:creator>
      <pubDate>Tue, 08 Sep 2026 12:22:51 +0000</pubDate>
      <link>https://dev.to/fidel_okumu/functions-writing-reusable-code-g65</link>
      <guid>https://dev.to/fidel_okumu/functions-writing-reusable-code-g65</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
As my scripts grew longer, I noticed the same blocks of logic showing up again and again.&lt;br&gt;
Functions  lets a user write a piece of logic once and reuse it anywhere, with different data each time. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Defining and Calling Functions&lt;/strong&gt;&lt;br&gt;
Defining a function only saves its instructions — it doesn't run anything yet:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F07m7xk3hq4tcoej5mec5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F07m7xk3hq4tcoej5mec5.png" alt=" " width="546" height="118"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Calling it is what actually executes the code:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyukt2tiyuvyafcl97qkm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyukt2tiyuvyafcl97qkm.png" alt=" " width="756" height="92"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Parameters and Arguments&lt;/strong&gt;&lt;br&gt;
A parameter is the placeholder name written inside the function definition — an empty slot waiting for a value.&lt;br&gt;
 An argument is the real value handed over when the function is actually called.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkyo9k6xhwqqrnx26pzs5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkyo9k6xhwqqrnx26pzs5.png" alt=" " width="800" height="120"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A function can take multiple parameters&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgp24odeqmyu9ix7983aj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgp24odeqmyu9ix7983aj.png" alt=" " width="628" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Return Values&lt;/strong&gt;&lt;br&gt;
Return sends a value back to whoever called the function, so it can be stored and reused elsewhere — unlike print(), which only displays something once.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbhif66inby2bqnx6wpst.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbhif66inby2bqnx6wpst.png" alt=" " width="800" height="166"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An important detail: as soon as a function hits a return statement, it exits immediately. Any code written after return inside that function never runs&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I Learned&lt;/strong&gt;&lt;br&gt;
Functions reframed how I think about writing code — instead of asking "what should this line do," I started asking "what small reusable task does this represent?, and what inputs does it need?." Understanding parameters versus arguments, and that variables inside a function have their own separate scope&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>coding</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>PYTHON Data Structures lists, Tuples, Dictionaries and Sets</title>
      <dc:creator>Fidel Okumu</dc:creator>
      <pubDate>Tue, 08 Sep 2026 11:50:15 +0000</pubDate>
      <link>https://dev.to/fidel_okumu/python-data-structures-lists-tuples-dictionaries-and-sets-5ghl</link>
      <guid>https://dev.to/fidel_okumu/python-data-structures-lists-tuples-dictionaries-and-sets-5ghl</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;INTRODUCTION&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
After learning storing single values in variables, We needed a way to hold collection of data i.e multiple ride counts&lt;br&gt;
multiple cities etc. &lt;br&gt;
Python offers four main data structures for this that is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LISTS&lt;/strong&gt;&lt;br&gt;
A list is a built-in data type used to store multiple items in a single variable. &lt;br&gt;
A list can be changed and allows addition of more items&lt;br&gt;
It can also contain items of different data types&lt;br&gt;
Lists also preserve and allows duplicate values&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp1kyhfj232oho596nruj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp1kyhfj232oho596nruj.png" alt=" " width="797" height="60"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frifzchl2rohe3dvqn2p5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frifzchl2rohe3dvqn2p5.png" alt=" " width="798" height="40"&gt;&lt;/a&gt;&lt;br&gt;
![ ](&lt;a href="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/njfzoohpy0tokgot2si1.png" rel="noopener noreferrer"&gt;https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/njfzoohpy0tokgot2si1.png&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TUPLES&lt;/strong&gt;&lt;br&gt;
A tuple is similar to a list but once created, it cannot be changed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsdbx9ixu099rach9dl9p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsdbx9ixu099rach9dl9p.png" alt=" " width="496" height="38"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Trying to modify a tuple raises an error by design. &lt;br&gt;
Tuples are mainly used when values should stay fixed throughout a program example: routes  fixed origin and destinations.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu1mka1leicksi8cg95aj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu1mka1leicksi8cg95aj.png" alt=" " width="800" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DICTIONARIES&lt;/strong&gt;&lt;br&gt;
A dictionary stores data in key-value.&lt;br&gt;
This allows lookups by name instead of position&lt;br&gt;
example;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4z486wrqa02tof3wojun.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4z486wrqa02tof3wojun.png" alt=" " width="799" height="179"&gt;&lt;/a&gt;&lt;br&gt;
Dictionaries are written in curly brackets {} &lt;br&gt;
Each has a corresponding value &lt;br&gt;
The keys should be unique &lt;br&gt;
Dictionaries can be changed &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SETS&lt;/strong&gt;&lt;br&gt;
A set stores only unique values any duplicates are automatically removed&lt;br&gt;
They are written using curly brackets {}&lt;br&gt;
You can add or remove items in a set &lt;br&gt;
They are useful when keeping unique items &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpv6qlaiwo8121e48m5iz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpv6qlaiwo8121e48m5iz.png" alt=" " width="800" height="94"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I Learned&lt;/strong&gt;&lt;br&gt;
The most useful shift in understanding was realizing that choosing a data structure is really a design decision, not just a syntax choice. Picking a list when a dictionary is more appropriate (or vice versa) doesn't just look sloppy — it makes later code longer and harder to reason about. Matching the structure to what the data actually needs to do made every function I wrote afterward noticeably simpler.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>computerscience</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
