<?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: Troye Gilbert</title>
    <description>The latest articles on DEV Community by Troye Gilbert (@troyegilbert).</description>
    <link>https://dev.to/troyegilbert</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%2F818547%2Fc5fedb79-9c4c-4b86-a010-f28a6952340c.jpeg</url>
      <title>DEV Community: Troye Gilbert</title>
      <link>https://dev.to/troyegilbert</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/troyegilbert"/>
    <language>en</language>
    <item>
      <title>Data Structures and Algorithms using Python</title>
      <dc:creator>Troye Gilbert</dc:creator>
      <pubDate>Mon, 21 Feb 2022 20:13:22 +0000</pubDate>
      <link>https://dev.to/troyegilbert/data-structures-and-algorithms-using-python-1m7l</link>
      <guid>https://dev.to/troyegilbert/data-structures-and-algorithms-using-python-1m7l</guid>
      <description>&lt;p&gt;As the name suggests, data structures allow us to organize, store, and manage data for efficient access and modification.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Lists
&lt;/h2&gt;

&lt;p&gt;A list is defined using square brackets and holds data that is separated by commas. The list is mutable and ordered. It can contain a mix of different data types.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PcOizqTs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j1io8oq6f85xa43fd92q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PcOizqTs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j1io8oq6f85xa43fd92q.jpg" alt="Lists" width="880" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Tuples
&lt;/h2&gt;

&lt;p&gt;A tuple is another container. It is a data type for immutable ordered sequences of elements. Immutable because you can’t add and remove elements from tuples, or sort them in place.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---NPbxi_9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9xkcx22rby2t7y7pikpn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---NPbxi_9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9xkcx22rby2t7y7pikpn.jpg" alt="Tuples" width="728" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Sets
&lt;/h2&gt;

&lt;p&gt;Set is a mutable and unordered collection of unique elements. It can permit us to remove duplicate quickly from a list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7YKNJ8ZN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ag4ach683veqi64s70xj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7YKNJ8ZN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ag4ach683veqi64s70xj.jpg" alt="Sets" width="487" height="193"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Dictionaries
&lt;/h2&gt;

&lt;p&gt;Dictionary is a mutable and unordered data structure. It permits storing a pair of items (i.e. keys and values). As the example below shows, in the dictionary, it is possible to include containers into other containers to create compound data structures.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zIVU06cv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9elmzogx0c7ieqkvxb0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zIVU06cv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9elmzogx0c7ieqkvxb0.jpg" alt="Image description" width="707" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Stack
&lt;/h2&gt;

&lt;p&gt;Stack is a linear data structure where elements are arranged sequentially. It follows the mechanism L.I.F.O which means last in first out. Stack has the following operations:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Push → inserting an element into the stack&lt;/li&gt;
&lt;li&gt;Pop → deleting an element from the stack&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  6. Queue
&lt;/h2&gt;

&lt;p&gt;Queue is a linear data structure where elements are in a sequential manner. It follows the F.I.F.O mechanism that means first in first out. Queue has the following operations:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Enqueue → inserting an element into the queue. It will be done at the rear.&lt;/li&gt;
&lt;li&gt;Dequeue → deleting an element from the queue. It will be done at the front.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  7. Tree
&lt;/h2&gt;

&lt;p&gt;Trees are used to define hierarchy. It starts with the root node and goes further down, the last nodes are called child nodes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Algorithms
&lt;/h2&gt;

&lt;p&gt;Algorithms are instructions that are formulated in a finite and sequential order to solve problems. When we write an algorithm, we have to know what is the exact problem, determine where we need to start and stop and formulate the intermediate steps. There are three main approaches to solve algorithms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Divide and Conquer&lt;/strong&gt; → it divides the problem into sub-parts and solves each one separately&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic programming&lt;/strong&gt; → it divides the problem into sub-parts remembers the results of the sub-parts and applies it to similar ones&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Greedy algorithms&lt;/strong&gt; → involve taking the easiest step while solving a problem without worrying about the complexity of the future steps&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>dsa</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>Introduction to Modern Python</title>
      <dc:creator>Troye Gilbert</dc:creator>
      <pubDate>Mon, 21 Feb 2022 18:53:53 +0000</pubDate>
      <link>https://dev.to/troyegilbert/introduction-to-modern-python-2288</link>
      <guid>https://dev.to/troyegilbert/introduction-to-modern-python-2288</guid>
      <description>&lt;p&gt;Python is among the most popular programming languages in the world. It is ranked high in different StackOverflow programming surveys each year. This article helps beginners familiarize themselves with the basic concepts of Python. According to the official documentation, Python is a high-level and general-purpose programming language.&lt;/p&gt;

&lt;p&gt;Python was built to be easier to use than other programming languages. It’s usually much easier to read Python code and much faster to write code in Python than in other languages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with Python
&lt;/h2&gt;

&lt;p&gt;First of all, to check the version of Python installed in your machine, type as follows in the terminal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jQAzK2qC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yg4m5dxiabwap3e9ta74.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jQAzK2qC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yg4m5dxiabwap3e9ta74.png" alt="Check Version" width="505" height="79"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If there is no Python installed, you can install it using the instuctions in the official website &lt;a href="https://www.python.org/downloads/"&gt;Download Python&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  First Python Code
&lt;/h2&gt;

&lt;p&gt;We are going to write our first Python program which prints out our name by typing in our preferred code editor as follows:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--06XJSTIm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nrzlr3fedi150s50obkq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--06XJSTIm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nrzlr3fedi150s50obkq.png" alt="Image description" width="338" height="77"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We then run our first python code by navigating to the directory where we have saved the file then run it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ilLY85K6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jas23c9k3gndasrz6718.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ilLY85K6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jas23c9k3gndasrz6718.png" alt="Python Program" width="516" height="105"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Alternatively, we can run the python code directly from the terminal since it is quicker and easier.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XCxvpWGe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ag6mifa8qulmxesxzpy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XCxvpWGe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ag6mifa8qulmxesxzpy.png" alt="Image description" width="717" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it we have created our first python program. To exit the terminal,you type &lt;strong&gt;quit()&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Python Syntax
&lt;/h2&gt;

&lt;p&gt;Like any other language, Python also follows a given set of rules such as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Python is case-sensitive, which means, for example, Name and name have different meanings.&lt;/li&gt;
&lt;li&gt;The standard is to use English names in programming.&lt;/li&gt;
&lt;li&gt;All variables should start with a lowercase letter, eg, var = 4.&lt;/li&gt;
&lt;li&gt;Functions begin with lowercase.&lt;/li&gt;
&lt;li&gt;Classes begins with a capital letter.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Variables and Data types.
&lt;/h2&gt;

&lt;p&gt;Variables are the basic unit of storage for a program. Programs perform operations on variables and alter or fill in their values. Objects are higher level constructs that include one or more variables and the set of operations that work on these variables. Let's try creating variables to store data.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EMxh--qP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4k3fa8fl3paplsh8lnv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EMxh--qP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4k3fa8fl3paplsh8lnv.png" alt="Variables" width="736" height="243"&gt;&lt;/a&gt;&lt;br&gt;
To check for the data type of a variable, you proceed as shown below:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Rlyzzge5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c999igh2f4xyoqgykdai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rlyzzge5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c999igh2f4xyoqgykdai.png" alt="Check Data Type" width="675" height="233"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Classes and Objects
&lt;/h2&gt;

&lt;p&gt;Every Object belongs to a certain class. Classes are abstract descriptions of the structure and functions of an object. Objects are created when an instance of the class is created by the program. For example, “Fruit” is a class while an “Apple” is an object.&lt;/p&gt;

&lt;p&gt;Congratulations on creating our first Python program and getting a brief introduction. In the next Python post, I am going to focus on Data Structures in Python.&lt;/p&gt;

</description>
      <category>python</category>
      <category>tutorial</category>
      <category>100daysofcode</category>
    </item>
  </channel>
</rss>
