<?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: Felix Olonde</title>
    <description>The latest articles on DEV Community by Felix Olonde (@felixia).</description>
    <link>https://dev.to/felixia</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F812923%2F894531c6-72de-46d1-b722-2773f4943989.jpeg</url>
      <title>DEV Community: Felix Olonde</title>
      <link>https://dev.to/felixia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/felixia"/>
    <language>en</language>
    <item>
      <title>Python:Introduction To Data Structure and Algorithm </title>
      <dc:creator>Felix Olonde</dc:creator>
      <pubDate>Mon, 21 Feb 2022 20:19:10 +0000</pubDate>
      <link>https://dev.to/felixia/pythonintroduction-to-data-structure-and-algorithm-5heo</link>
      <guid>https://dev.to/felixia/pythonintroduction-to-data-structure-and-algorithm-5heo</guid>
      <description>&lt;p&gt;Key to learning and mastering any programming language is knowing its data structure and how to write algorithm using that specific language. Python being one of the most popular language in programming arena, mastering its data structure is very important.&lt;/p&gt;

&lt;p&gt;Data structures are containers used for organization of data for storage and easy retrieval.&lt;br&gt;
In this article we will discuss some of the most popular and used data structures in python.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;List&lt;/strong&gt;: A list is used to store multiple data items in a single variable.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fruits = ['Apple','Orange','Guava']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Lists are ordered. This means you can retrieve a list item via an index.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;result = fruits[1] #Orange
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is worth to note that lists are zero base indexed. This means that the first item in the list is having index zero.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;result = fruits[0] #Apple
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last item in the list can be retrieved as follows:&lt;br&gt;
&lt;code&gt;result = fruits[-1]&lt;/code&gt;&lt;br&gt;
Just like string, lists can be sliced.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;result = fruit[1:2]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lists are mutable. Meaning you can add and remove items as you desire.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Tuples&lt;/strong&gt;:
Unlike lists, Tuples are immutable.This is to say that once a tuple is defined, it cannot be changed.
Items in the tuple can be modified but you cannot add or remove an item from the tuple. A tuple is defined as follows:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Dimension = (20,30,40)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Sets&lt;/strong&gt;:
Sets unlike tuples can not contain duplicates. They are suitable for storing data that should not contain duplicates ie IDs.
We define sets as follows:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;professionals = {'Doctor','Teacher','Engineer'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sets are immutable and unordered.&lt;br&gt;
You can get the length of a set using the method &lt;code&gt;len()&lt;/code&gt;&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;professionals = {'Doctor','Teacher','Engineer'}
len(professionals ) #3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Dictionaries&lt;/strong&gt;:
They store data in key-value pairs. They are ordered(As per version 3.7 and above), changeable and do not allow duplicates.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;car= {
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964
}
print(car)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.&lt;strong&gt;Stack&lt;/strong&gt;:&lt;br&gt;
 stack is a linear data structure that stores items in a Last-In/First-Out (LIFO) or First-In/Last-Out (FILO) manner.&lt;br&gt;
Stack in Python can be implemented using the following ways: &lt;/p&gt;

&lt;p&gt;list&lt;br&gt;
Collections.deque&lt;br&gt;
queue.LifoQueue&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Queue&lt;/strong&gt;:
Like stack, queue is a linear data structure that stores items in First In First Out (FIFO) manner. With a queue the least recently added item is removed first. A good example of queue is any queue of consumers for a resource where the consumer that came first is served first.
Operations associated with queue are: &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Enqueue: Adds an item to the queue. If the queue is full, then it is said to be an Overflow condition – Time Complexity : O(1)&lt;br&gt;
Dequeue: Removes an item from the queue. The items are popped in the same order in which they are pushed. If the queue is empty, then it is said to be an Underflow condition – Time Complexity : O(1)&lt;br&gt;
Front: Get the front item from queue – Time Complexity : O(1)&lt;br&gt;
Rear: Get the last item from queue – Time Complexity : O(1)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Python 101: Getting Started With Modern Python</title>
      <dc:creator>Felix Olonde</dc:creator>
      <pubDate>Mon, 14 Feb 2022 18:13:43 +0000</pubDate>
      <link>https://dev.to/felixia/python-101-getting-started-with-modern-python-1f50</link>
      <guid>https://dev.to/felixia/python-101-getting-started-with-modern-python-1f50</guid>
      <description>&lt;p&gt;Python is one of the top most sorted out programming language with a vast usage from web development  to data science and Machine Learning. Being a scripting language, python is not only easy to learn but also easy to write as it has English-like syntax.&lt;/p&gt;

&lt;p&gt;Python has various data types which includes numerical values, string, data structure which includes list, tuple, set and dictionary.&lt;br&gt;
Declaring a variable in python is as easy as below:&lt;br&gt;
&lt;code&gt;name = Wambua&lt;/code&gt;&lt;br&gt;
You can define several variables in a raw as below:&lt;br&gt;
&lt;code&gt;a, b, c = 1, 2,3&lt;/code&gt;&lt;br&gt;
To display an output in python, you use the function &lt;code&gt;print&lt;/code&gt;&lt;br&gt;
For example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = 'Otieno'
age = 12
print(name)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Integers and floats are numerical data type in python. If you want know the type of data you are dealing with you use the function &lt;code&gt;type()&lt;/code&gt;. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;age = 33
type(age) #int
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;String is another data type in python. Unlike other languages, python does not have a &lt;code&gt;character&lt;/code&gt;. It therefore treats a character as a string of length 1.&lt;br&gt;
To know the length of a string, python uses the function &lt;code&gt;len()&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = 'Daniel'
result = len(name)
print(result) #6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Functions are blocks of code that do a specific job. In python, functions are defined as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def add_2(x):
return x+2

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To call a function, you just have write the name of the function followed by parenthesis then passing the argument if any.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;add_2(5)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Data structures in python are containers for storing data for processing. These includes &lt;/p&gt;

&lt;p&gt;-List&lt;br&gt;
-Dictionary&lt;br&gt;
-Tuples&lt;br&gt;
-Set&lt;br&gt;
We shall discuss in details the functionalities of the above data structures. Keep learning!!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
