<?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>Forem: RCharlotte</title>
    <description>The latest articles on Forem by RCharlotte (@rcharlotte).</description>
    <link>https://forem.com/rcharlotte</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%2F812671%2F3c7bf633-b9e7-4f24-af36-779d34d8b7b7.png</url>
      <title>Forem: RCharlotte</title>
      <link>https://forem.com/rcharlotte</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/rcharlotte"/>
    <language>en</language>
    <item>
      <title>Python for Everyone: Mastering Python the Right Way</title>
      <dc:creator>RCharlotte</dc:creator>
      <pubDate>Wed, 02 Mar 2022 16:23:44 +0000</pubDate>
      <link>https://forem.com/rcharlotte/python-for-everyone-mastering-python-the-right-way-2n55</link>
      <guid>https://forem.com/rcharlotte/python-for-everyone-mastering-python-the-right-way-2n55</guid>
      <description>&lt;p&gt;&lt;strong&gt;Python for Everyone&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Admittedly, Python is not my first language. As a natural result, my transition from other languages to Python have been extremely easy, considering the latter's ease of use, and memorability, in comparison to other languages. It's massive gain of popularity in recent years is no coincidence, and is actually a consequence of the perks I have mentioned, along with being beginner-friendly, yet also doubling up as a strong asset in more complex solutions such as big data analytics. At one point or another, all of us have had to break into something new- a career, a project, owning a house, or whatever it was. The consistent underlying theme is that unchartered paths are seldom easy, and can be very confusing for a beginner, so if you are going through that chaotic space, this is the article for you. And if you are not, this might just help you carve out a better stance for mastering python the right way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An Overview of Python&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python is a high-level interpreted language that was created by Guido van Rossum, and named by Rossum after &lt;em&gt;Monty Python's Flying Circus&lt;/em&gt;, a BBC comedic series of the 1970s. Perhaps due to its recent popularity, many people think Python is a new programming language. Contrary to this, Python was actually first released in 1991, and is even older than traditionally "old" languages such as Java. With the rise in needs such as programming in data science and machine learning, python has provided an easy go-to, for people not trained as programmers to get started. Additionally, older versions of Python could not address specific domains as competing languages could. Take for example Django, a python web-framework, which was created more than a decade after the release of python to simplify web development. However, as we move towards an automated world, where coding has become a sought-after skill, you cannot hate Python, as it provides an easy way to get started with programming. Now, how should you approach it?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Python Learning Steps&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is easy to get caught up in the vicious cycle of wanting to learn everything at once, but it is very important to not succumb to this temptation. One, because it never works, and two, it could leave you extremely disoriented. Instead, start small:&lt;/p&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Create a learning path.
&lt;/h2&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;p&gt;There is a lot to learn before you will have complete mastery of the language, and although this may seem daunting, it is no rocket-science. It is doable.&lt;/p&gt;

&lt;p&gt;First, learn the basics. Create your "hello world" program in python, and if you are past the beginner status, look into the &lt;strong&gt;variables, data types, keywords, identifiers, operators and built-in functions&lt;/strong&gt; (excluding print) that you can use regularly, and have those at your fingertips. After the fundamentals, examine real-world problems and be able to see how you can convert the normal human thought process and decision making, into codable language, such as &lt;strong&gt;sequential processing, flow control,decision making with loops, relational operators,&lt;/strong&gt; and &lt;strong&gt;boolean operators&lt;/strong&gt; in python.&lt;/p&gt;

&lt;p&gt;Next, make sure you have your &lt;strong&gt;data structures&lt;/strong&gt; to a T, because what's the point in knowing them theoretically if you are unable to implement them when and as needed? when you feel comfortable with data structures, both &lt;strong&gt;user-built and pre-built&lt;/strong&gt;, make your way to &lt;strong&gt;algorithms&lt;/strong&gt;, and deploy them in a way that makes your data structures exploit their full capability.&lt;/p&gt;

&lt;p&gt;At the instance you can comfortably apply data structures practically in real-world use cases, it is time to have a deeper look into &lt;strong&gt;functions&lt;/strong&gt;. Pre-built functions are there so you don't re-invent the wheel, and waste valuable coding time, but Python also allows for you to build your own functions to match unique use-cases. So look into this, while paying attention to the &lt;strong&gt;scope&lt;/strong&gt; of each function, what &lt;strong&gt;parameters&lt;/strong&gt; are, and how to use them, &lt;strong&gt;recursive&lt;/strong&gt; and &lt;strong&gt;lambda&lt;/strong&gt; functions, and decorators in python.&lt;/p&gt;

&lt;p&gt;As Python is an Object Oriented Language, it uses &lt;strong&gt;classes&lt;/strong&gt;, which allow for inheritance, and other features that make the language quire remarkable. Here, look into defining classes, using classes to create objects and instance data, using &lt;strong&gt;constructors&lt;/strong&gt; to simplify coding, and how to use &lt;strong&gt;class methods&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After fully grasping the idea of classes in Python, move steadily to &lt;strong&gt;errors and exception handling&lt;/strong&gt;, including the use of &lt;strong&gt;try/catch/else/finally&lt;/strong&gt; to handle exceptions, look into ignoring exceptions, and explore the wide array of errors, such as &lt;strong&gt;syntax, logical&lt;/strong&gt; and &lt;strong&gt;semantic&lt;/strong&gt; errors, that will make you a better and faster programmer in the long-run.&lt;/p&gt;

&lt;p&gt;You then have to be comfortable to &lt;strong&gt;work with files&lt;/strong&gt;, such as opening, reading, and writing a file using Python code, and further look into &lt;strong&gt;modules and packages of python&lt;/strong&gt;, &lt;strong&gt;Regular Expressions&lt;/strong&gt; in Python, and finally, &lt;strong&gt;Network Services&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Practice! Practice! Practice!
&lt;/h2&gt;

&lt;p&gt;**&lt;br&gt;
That seems like a long list, but that is why I emphasize on taking small but sure steps. It is possible to build on becoming a better programmer by using the resources around you- YouTube has especially worked magic for me, by giving me a chance to improve my skills and learn a little of everything everyday through projects. Once you learn the basics, data structures and algorithms, I believe you are unstoppable. So take up those projects, and when you are stuck, Google is your best friend! Use Stack Overflow as a tool to learn, and not to just copy and paste code. And if you prefer reading to watching tutorials, you can always get yourself a copy of texts such as &lt;em&gt;Learn Python the Hard Way&lt;/em&gt; (It is a good one, don't mind the click-bait title). &lt;/p&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Final Perspective
&lt;/h2&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;p&gt;In trying to become a master, you should be prepared to make and embrace your mistakes. Because after all, a master is only a master because they made mistakes, used those to make learning strides, and implemented this knowledge in avoiding mistakes. &lt;/p&gt;

&lt;p&gt;Rather than working your boots off trying to be master, however,  focus on gaining understanding, proficiency, and excellence in applying fundamental Python principles. I say this because although I understand that Python still has a long mileage to cover, any language has its hay days, and bad days. But if you master the fundamentals, and underlying principals, those are often consistent and can be shifted from one language to the next- Those are the things that remain steadfast even as tides change, and they will ensure you are competent for years to come.&lt;/p&gt;

&lt;p&gt;Good luck, and happy coding!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Python: A Beginner's Guide to Data Structures and Algorithms</title>
      <dc:creator>RCharlotte</dc:creator>
      <pubDate>Mon, 21 Feb 2022 06:36:28 +0000</pubDate>
      <link>https://forem.com/rcharlotte/python-beginners-guide-to-data-structures-and-algorithms-3908</link>
      <guid>https://forem.com/rcharlotte/python-beginners-guide-to-data-structures-and-algorithms-3908</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;What are Data Structures?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A data structure is a specialized data format that is used to store, organize, and manage data for efficient access and modification.&lt;/p&gt;

&lt;p&gt;To understand data structures better, it is vital to see what drives the concept, and how it is an evolution from daily living. Organized storage is evident all around us, right from how phone books are recorded, arrangement in closets, car-parking lots, and even restaurant seating spaces. The idea behind the structuring storage is to allow ease of access and manipulation as necessary.&lt;/p&gt;

&lt;p&gt;Just as every human ordered storage has features that differ from another, every data structure has different information that is unique to it, concerning information on the data values allowed, relationships between the data, and applicable functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why are Data Structures Needed?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Data structures provide the right way to organize data, and ensure that a lot of data is accessed, used or, processed in a short interval of time. In this way, the ordered storage comes in handy to ensure no repetition, and ordered access, all of which are vital in big data systems such as Artificial Intelligence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Data Structures in Python&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ks62Hq1R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ngqsnm5vj90z4qt2u435.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ks62Hq1R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ngqsnm5vj90z4qt2u435.png" alt="Data Structures in Python" width="880" height="326"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Built-In Data Structures
&lt;/h2&gt;

&lt;p&gt;Python has four built-in data structures:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Lists&lt;/strong&gt;&lt;br&gt;
Python lists are a versatile type of data structure that allow more than one data type to be stored at a time.&lt;br&gt;
You can initialize and define a list by placing a sequence of items in squared brackets, and separating the elements by commas 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;#initializing a list
list1= []

#initializing and defining lists with different data types
listNumbers= [1,2,3,4,5]

listNames=["Charlotte","Magdalene"]

listMixed=[1,2,"Charlotte"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The order in a list follows indexing positions, whereby the first index position (index 0) is the first element in the list, and the second index position (index 1) is the second element in the list, and so on. Therefore, to &lt;strong&gt;access list elements&lt;/strong&gt;, use the index operator &lt;code&gt;[]&lt;/code&gt;, 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;listNumbers= [1,2,3]

#print first number
print(listNumbers[0])

#print second number
print(listNumbers[1])

#print third number
print(listNumbers[2])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Other exciting features that list allows include: &lt;br&gt;
&lt;code&gt;print(listNumbers[0:2])&lt;/code&gt; which prints object at index 0 and 1, but reject object[2].&lt;br&gt;
&lt;code&gt;print(listNumbers[0:4:2])&lt;/code&gt; which prints objects from index 0 to 4, in steps of 2, but reject object[4].&lt;br&gt;
&lt;code&gt;print(listNumbers[0:4:2])&lt;/code&gt; which prints objects from index 0 to 4, in steps of 2, but reject object[4].&lt;br&gt;
&lt;code&gt;print(listNumbers[::-1])&lt;/code&gt; which prints objects from the last index to the first index position.&lt;br&gt;
&lt;code&gt;print(sorted[listNumbers])&lt;/code&gt; which prints objects in ascending order, without changing the original list.&lt;br&gt;
If you want to print your list in descending order, the code that can be used is &lt;code&gt;listNumbers.sort(reverse=true)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Take note that the last index position is the total number of elements minus 1, to take care of the first index position beginning at 0, and not 1.&lt;/p&gt;

&lt;p&gt;The three functions that can be used to &lt;strong&gt;add more objects&lt;/strong&gt; into &lt;code&gt;listNumbers&lt;/code&gt; are &lt;code&gt;append()&lt;/code&gt;, &lt;code&gt;extend()&lt;/code&gt;, and &lt;code&gt;insert()&lt;/code&gt;, as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#add 4 to the end of the list
listNumbers.append(4)

#add 5 at the 4th index position
listNumbers.insert(4,5)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To &lt;strong&gt;remove/delete objects from the list&lt;/strong&gt;, the following functions can be used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;del()&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;pop()&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;remove()&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
#delete the object at index 3 from the list
del listNumbers(3)

#to remove objects at a specified index position, and store the objects that have been deleted.
a= listNumbers.pop(4)
print(a)

#to remove a specific object from known objects in a list.
b= listNumbers.pop(2)

#to know the index of a particular element in the list
print(listNumbers(3))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Tuples&lt;/strong&gt;&lt;br&gt;
A Tuple in python is a finite ordered list of objects separated by commas. Unlike lists, tuples are immutable, and are much faster. This means that its value cannot be updated.&lt;br&gt;
You can initialize and define a tuple by placing a sequence of items in brackets, and separating the elements by commas 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;tupleNumbers= (1,2,3)

#print first number
print(tupleNumbers[0])

#print second number
print(tupleNumbers[1])

#print third number
print(tupleNumbers[2])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once a tuple is assigned, you cannot change data in it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Sets&lt;/strong&gt;&lt;br&gt;
A set is an un-ordered collection of unique elements that is mutable. A set is initialized and defined as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;set1={1,2,3,4,5}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a value is repeated in the definition of a set, upon printing it, the repeated value is done away with.&lt;/p&gt;

&lt;p&gt;To *&lt;em&gt;add elements *&lt;/em&gt;, use the function add(), for example, &lt;code&gt;set1.add(0)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Other operations that sets have are explored in the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#union() combines two unions and eliminates repetitive values in the set.
set1.union(set2)

#intersection() prints the values that are repeated between sets that are being compared.
set1.intersection(set2)

#difference() prints the values that are unique for the first set in comparison to those in the set to which it is being compared.
set1.difference(set2)

#symmetricdifference() prints the values that are unique between sets that are being compared.
set1.symmetricdifference(set2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Dictionaries&lt;/strong&gt;&lt;br&gt;
A dictionary is a mutable structure that holds key value pairs. A key value-pair associates a key with values, for example, a key could be last_Name, and it could be populated with different last names as its values.&lt;br&gt;
A dictionary is initialized and 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;dict1= {1: 'Javascript', 2: 'Java'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, 1 is the key for which Python is the value, and 2 is the key for which Java is the value.&lt;br&gt;
Because it is mutable, trying to change a value in the dictionary will not throw an error, 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;dict1= {1: 'Javascript', 2: 'Java'}
print(dict1)
dict1[1] = 'Python'
print(dict1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Upon printing this, the output will be as below:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o2Mkvju9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/22xb48k306wrylk4emx0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o2Mkvju9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/22xb48k306wrylk4emx0.png" alt="Dictionary in Python" width="499" height="89"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To &lt;strong&gt;delete a value in a dictionary&lt;/strong&gt;, we use : &lt;code&gt;del dict1[1]&lt;/code&gt;&lt;br&gt;
You can also use &lt;code&gt;dict1.pop(1)&lt;/code&gt; for the same purpose of deleting a value. Since pop() has a return value, you can print this to indicate the exact value that has been deleted.&lt;br&gt;
&lt;code&gt;dict1.popitem()&lt;/code&gt;can be used to remove the last value in a dictionary.&lt;/p&gt;

&lt;p&gt;Other important functions are shown in the code snippet below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#show all keys in the dictionary
print(dict1.keys())

#show all values in the dictionary
print(dict1.values())

#show all key-value pairs in the dictionary
print(dict1.items())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  User-Defined Data Structures
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Arrays&lt;/strong&gt;&lt;br&gt;
Arrays are structures used to store data of a single type. This makes them almost similar to lists, with the difference that arrays are homogenous, and not heterogenous.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import array

arrayNumbers= array.array('i',[1,2,3,4,5])

for i in sample_array:

print (i)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Stacks&lt;/strong&gt;&lt;br&gt;
Stacks are made from arrays, and they follow the Last In First Out (LIFO) principle. They have a pointer called TOP that is used to track the top of the element. Below is an image showing how TOP keeps track of the top most element as elements are being pushed into a stack.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uVNvLPpt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5yd4yrs4nji5pqd260tp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uVNvLPpt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5yd4yrs4nji5pqd260tp.png" alt="TOP pointer in Stacks" width="269" height="274"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#initializing a stack
stack1=[]

val1= 1
val2 = 2

#appending values to the stack
stack1.append(val1)
stack1.append(val2)

#removing values from the stack in order of LIFO
stack.pop()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Queues&lt;/strong&gt;&lt;br&gt;
Queues are similar to stacks, but they follow the FIFO principle( First In First Out) Principle.&lt;br&gt;
Additionally, operations can be performed from the beginning and the end of the queue.The En-Queue Operation keeps note of the head as the first element and the tail as the last element in that order as they are added:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LdAPPStO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59wqszrjtt7dpkn601u0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LdAPPStO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59wqszrjtt7dpkn601u0.png" alt="En-Queue Operation" width="292" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;De-Queueing deletes elements in the order that they were stored in the queue.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from collections import deque
q = deque()

#adds elements in the order of the 1st one in
q.append(1)
q.append(2)

#removes elements in the order of the 1st one out
q.popleft()
q.popleft()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Trees&lt;/strong&gt;&lt;br&gt;
Trees are used in defining hierarchy, and start with a root/parent node as they move further down into child nodes. Trees are particularly useful in html code, where tags are defined from the parent node to leaves(child nodes).Leaves are the final nodes in the hierarchical chain. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Graphs&lt;/strong&gt;&lt;br&gt;
In Python, graphs are used to store data in the form of edges and vertices. A graph is easily presented using the python dictionary data types, whereby the vertices are represented as keys of the dictionary, and the connection between the vertices( also known as edges) are represented as the values in the dictionary, as shown in the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# To create a dictionary that displays graph elements
graphExample = { 
   "a" : ["b","c"],
   "b" : ["a", "d"],
   "c" : ["a", "d"],
   "d" : ["e"],
   "e" : ["d"]
}
# Print the graph        
print(graphExample)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can represent the graph below:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--so_G6AQi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h6hbw6i7oxsb19ozu0cr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--so_G6AQi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h6hbw6i7oxsb19ozu0cr.png" alt="Graph in Python" width="456" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that we understand data structures, let us move to algorithms.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What are Algorithms ?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;An algorithm is a pre-meditated set of steps that are used to complete a certain task for a desired output. It forms the building blocks through which programming of devices enables them to communicate or do other functions smoothly.&lt;br&gt;
Taking the example of a GPS locator, with two use cases: locating a car, and avoiding traffic, there will be two separate algorithms to fulfill each task. If there is an error in the coding of any, the locator will not function correctly. This means that algorithms are in-built in machines to enable them make fast decisions efficiently.&lt;/p&gt;

&lt;p&gt;Some important programming algorithms include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sort Algorithm&lt;/strong&gt;, that is used to rearrange a given array or list elements according to a comparison operator on the elements. The comparison operator is used to decide the new order of element in the respective data structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Searching Algorithm&lt;/strong&gt;, that is designed to check for an element or retrieve an element from any data structure where it is stored.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recursive algorithm&lt;/strong&gt;, whereby a function calls itself with smaller input values and returns the result for the current input by carrying out basic operations on the returned value for the smaller input. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;h2&gt;
  
  
  The Relationship between Data Structures and Algorithms
&lt;/h2&gt;

&lt;p&gt;**&lt;br&gt;
Data structures and algorithms interrelate to and complement each other, and when used with this in mind, an algorithm that is applied to the correct data structure can drastically improve the performance of the algorithm.&lt;/p&gt;

&lt;p&gt;Some examples of algorithms that enhance the performance of data structures are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Search&lt;/strong&gt;- Helps find an item in a data structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Insert&lt;/strong&gt;-Helps insert an item in a data structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sort&lt;/strong&gt;-Helps sort items in a data structure in the required order.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update&lt;/strong&gt;- Useful in updating/adding a data item in an existing data structure.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>beginners</category>
      <category>python</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Python: A Beginner's Guide</title>
      <dc:creator>RCharlotte</dc:creator>
      <pubDate>Thu, 10 Feb 2022 13:06:47 +0000</pubDate>
      <link>https://forem.com/rcharlotte/python-a-beginners-guide-3o4d</link>
      <guid>https://forem.com/rcharlotte/python-a-beginners-guide-3o4d</guid>
      <description>&lt;p&gt;One of the more difficult things about enjoying challenges is that I naturally gravitate towards more difficult, tasking, cumbersome and demanding tasks, people, you name it. And as I ventured into coding, I still am no different. I began with C, followed closely by Java, and found myself thoroughly enjoying the infamously long syntaxes of the latter. &lt;br&gt;
So yes, Java is a first love. A memorable part of my programming and coding journey. But, when I was introduced to python, I knew the rubber had met the road, and there was no looking back.&lt;/p&gt;

&lt;p&gt;**&lt;/p&gt;
&lt;h3&gt;
  
  
  So, Why Python?
&lt;/h3&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ease of use&lt;/strong&gt;- Python has one of the easier and more flexible syntax rules that I have come across. If you have worked with Dart in Flutter, you know that code is not the only thing you have to worry about, with the strict punctuation rules of commas and full stops that can throw you off at any time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Versatility&lt;/strong&gt;- From a simple Fibonacci sequence, website development, and complex machine learning algorithms, its capacity is undeniable. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Popularity&lt;/strong&gt;- Python has quickly risen to the big leagues alongside veteran languages such as Java. I will go out on a limb, and say that it is one of the most sought-after skills in the software job market currently, and as is, a great add to your portfolio.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I wouldn't do this space justice if I did not share this remarkable tool with you, and showed you how to get started with Python:&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Installing Python in your machine
&lt;/h2&gt;

&lt;p&gt;The easiest way to do this is to download a Python Installer, which will do all the heavy-lifting for you at &lt;a href="https://www.python.org" rel="noopener noreferrer"&gt;Python Official Page&lt;/a&gt;. Make sure to install a version that is secure, and stable. This is not necessarily the latest version, and will be labelled &lt;em&gt;security&lt;/em&gt; under the &lt;em&gt;maintenance status&lt;/em&gt; column. The version you choose should also be compatible with your operating system.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Installing A Suitable Text Editor
&lt;/h2&gt;

&lt;p&gt;Visual Studio Code is a popular choice, due to the fact that it enables compilation of various programming languages, and not just Python. It still runs fairly fast on low-specs such as 4GB RAM machines, so you have nothing to worry about. Well, provided you are not trying to run too many applications alongside it, you're PC will be just fine. &lt;a href="https://code.visualstudio.com/download" rel="noopener noreferrer"&gt;You can download the latest version here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To be able to write Python code on VS Code, it is helpful to install a python extension, as shown below.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select the extension button to the left of the Interface.&lt;/li&gt;
&lt;li&gt;Select the first python extension.&lt;/li&gt;
&lt;li&gt;Select the install button, and prepare to start your first coding project.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm3swbltq65rdh7dhxquk.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm3swbltq65rdh7dhxquk.PNG" alt="Installing a Python Extension in VS Code"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Get Coding!
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create a folder in a preferred location on your PC.&lt;/li&gt;
&lt;li&gt;Navigate to VS Code, and select the File tab, followed by Open Folder, then select your created file.&lt;/li&gt;
&lt;li&gt;Once open, click on new file, and give it a suitable name, and remember to add &lt;code&gt;.py&lt;/code&gt; at the end of your chosen name.
For example, in this example, my file name is HelloWorld.py.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;.py enables the Python interpreter to identify the file and run it as python code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frlwrtzg8jj8synxqhznu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frlwrtzg8jj8synxqhznu.png" alt="Creating your First Python File in VS Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the Run and Debug button to the left of your VSCode Interface, and this will be the output on your terminal&lt;/p&gt;

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

&lt;p&gt;The python script is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
print ('From Hello World to Changing the World')

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

&lt;/div&gt;



&lt;p&gt;Now, how simple was that?&lt;/p&gt;

&lt;p&gt;Other versions of this can be written to increase flexibility and versatility of the code, 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;Statement = 'From Hello World to Changing the World'

print (Statement)

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

&lt;/div&gt;



&lt;p&gt;To better understand what is happening, I will explain the rules of Python at play here.&lt;/p&gt;

&lt;p&gt;As we are trying to print a statement to the terminal, we can take advantage of Python's rich functions, and use the &lt;code&gt;print()&lt;/code&gt; function.&lt;br&gt;
A function is a section of code meant to perform a specific task. In this case, the task is to print. Although you can create functions for yourself, the essence of high level programming is to increase your productivity, by ensuring that you do not re-invent the wheel, or waste time and energy creating inbuilt functions.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;print()&lt;/code&gt; accepts anything between its parenthesis, provided it follows a particular data-type known as String.&lt;br&gt;
A data-type classifies data items so that you, and the interpreter know what operations can be carried out on a data item. A string data type is denoted using single quotes &lt;code&gt;''&lt;/code&gt; , double quotes, &lt;code&gt;""&lt;/code&gt; , or triple quotes &lt;code&gt;"""&lt;/code&gt; .&lt;/p&gt;

&lt;p&gt;In this example, we use single quotes in &lt;code&gt;'From Hello World to Changing the World'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the second version, we use a variable/identifier to initialize and define the String. If any changes need to be made, therefore, we can alter the text from &lt;code&gt;Statement&lt;/code&gt;, and this helps us to separate areas of concern.&lt;/p&gt;

&lt;p&gt;The other 4 Standard data types that can be used in Python are Numbers, List, Tuple and Dictionary, which I will discuss in my future posts. For now, you can access this information at &lt;a href="https://developer.rhino3d.com/guides/rhinopython/python-datatypes/" rel="noopener noreferrer"&gt;Rhino Developer Docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now, as we are journeying on professional coding, we have to remember the importance of writing clear code. This begins by using comments.&lt;/p&gt;

&lt;p&gt;In python, comments are not executed, and are ignored by the Compiler. They are used to enhance understanding and readability of your code, and are denoted by &lt;code&gt;#&lt;/code&gt;, for a single line comment and triple quotes for a multi-line comment &lt;code&gt;"""  """&lt;/code&gt;&lt;br&gt;
A single line comment will be as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# My First Python Code

Statement = 'From Hello World to Changing the World'

print (Statement)

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

&lt;/div&gt;



&lt;p&gt;A multiple-line comment will be written as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
"""
This is my First Python Program

I love to code

"""
Statement = 'From Hello World to Changing the World'

print (Statement)

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

&lt;/div&gt;



&lt;p&gt;As you have seen, Python is easy to follow, and can be a powerful tool once you have mastered its ins and outs. It is no wonder that it has become that: Python, My Second Love.&lt;/p&gt;

&lt;p&gt;image credits: &lt;a href="https://freetutsdownload.net/wp-content/uploads/2021/10/Python-101-Learn-Python-Programming-for-Absolute-Beginners.jpg" rel="noopener noreferrer"&gt;Link&lt;/a&gt;&lt;/p&gt;

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