<?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: Samwel Njihia</title>
    <description>The latest articles on DEV Community by Samwel Njihia (@samgnjihia).</description>
    <link>https://dev.to/samgnjihia</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%2F813461%2Fdc7d9dcb-4843-4dea-84bf-de82baa7f588.png</url>
      <title>DEV Community: Samwel Njihia</title>
      <link>https://dev.to/samgnjihia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/samgnjihia"/>
    <language>en</language>
    <item>
      <title>Python for Everyone: Mastering Python the right way </title>
      <dc:creator>Samwel Njihia</dc:creator>
      <pubDate>Wed, 02 Mar 2022 13:47:29 +0000</pubDate>
      <link>https://dev.to/samgnjihia/python-for-everyone-mastering-python-the-right-way-2lgb</link>
      <guid>https://dev.to/samgnjihia/python-for-everyone-mastering-python-the-right-way-2lgb</guid>
      <description>&lt;p&gt;Are you new to the Python programming language? Are you at an advanced level?. Whatever level you are, this article is crucial as it will act as a guidance and as a reference in your Python programming journey. This article discusses the learning pathway which results in mastering Python the right way.&lt;/p&gt;

&lt;h3&gt;
  
  
  The learning Pathways
&lt;/h3&gt;

&lt;p&gt;This section discusses the Python Learning Pathways, which will result in mastering Python the right way. What is the path from beginner to advanced, and the careers options are available in Python.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Learning Python Fundamentals
&lt;/h4&gt;

&lt;p&gt;As with any other language such as Java, one needs to start from the basics concepts from the simple project setup and syntax. Learn also the python PEP 8 conventions and have the basic knowledge of how to use Python. You will start by exploring variables, expressions, operators, conditional loops, and functions (You can get all these concept here with examples &lt;a href="https://dev.to/samgnjihia/python-101-ultimate-python-guide-or-introduction-to-modern-python-3oek"&gt;Python 101: Ultimate Python Guide or Introduction to Modern Python &lt;/a&gt; )&lt;br&gt;
Also, learn python data structures, i.e., the python in-built and user-defined data structure; moreover, learning algorithms in Python. All these concepts about data structure and algorithms with examples are discussed here in this article: &lt;a href="https://dev.to/samgnjihia/python-102-introduction-to-data-structures-and-algorithms-with-python-32i7"&gt; Python 102: Introduction to Data Structures and Algorithms With Python. &lt;/a&gt; ). After mastering the basic python fundamentals, one should start practicing with some mini projects to apply the basic fundamentals concepts learned.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Become Advanced in Python.
&lt;/h4&gt;

&lt;p&gt;Here you will add more advanced concepts to your python knowledge by learning how Python interacts with web Data, i.e., web scrapping, how to use Python for Object-Oriented Programming &lt;em&gt;(Classes, Inheritance, Data Abstraction, and Encapsulation are the main concepts covered here)&lt;/em&gt;. Final but not list concept to be covered here is integrating Python with databases( SQL Databases, No-SQL Databases, and APIs).&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Focus on Career pathway
&lt;/h4&gt;

&lt;p&gt;After covering the two above and being advanced in Python, it is time to focus and explore the career pathway. This will involve focusing and studying the Python Libraries and Frameworks that are specific to certain career paths. This section will discuss the common pathways for Python developers and their related libraries or frameworks. &lt;/p&gt;

&lt;h4&gt;
  
  
  a). Web Development
&lt;/h4&gt;

&lt;p&gt;Python offers a wide   range of frameworks for web development. These framework include  &lt;em&gt;&lt;strong&gt;Flask, CherryPy, Pyramid, Django and web2py.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  b). Data Science
&lt;/h4&gt;

&lt;p&gt;This will involve learning data Sourcing, Data Analysis, and Machine Learning with Python. Libraries that one can learn for this are:  &lt;em&gt;&lt;strong&gt;Numpy, Matplotlib, Pandas, SciPy, and SciKit&lt;/strong&gt;&lt;/em&gt; Learn for ML, among others.&lt;/p&gt;

&lt;h4&gt;
  
  
  c). Machine Learning and Artificial Intelligence
&lt;/h4&gt;

&lt;p&gt;AI is a popular career path that keeps gaining popularity in the current world. The top libraries that one can learn are :&lt;em&gt;&lt;strong&gt;SciKit Learn, Tensorflow, Keras, Natural Language Toolkit (NLTK), PyTorch, Theano, etc&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  d). Graphical User Interface (GUI) Programming
&lt;/h4&gt;

&lt;p&gt;This involves creating of graphical application using Python. Some of the libraries to learn are: &lt;em&gt;&lt;strong&gt;kinter, wxPython, PyQT, Kivy etc&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Game Development
&lt;/h4&gt;

&lt;p&gt;Game development is an interesting to explore.One needs to learn &lt;em&gt;&lt;strong&gt;PyGame&lt;/strong&gt;&lt;/em&gt; library for game development in python.&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;In conclusion Python is among the top programming language that is is in demand in the current market. One should spare some time and learn this language. The following are a suggestions of various projects that one can try to develop at different levels. Please drop some more suggestions of various projects in comment section:&lt;/p&gt;

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

</description>
      <category>webdev</category>
      <category>python</category>
      <category>django</category>
      <category>programming</category>
    </item>
    <item>
      <title>Python 102: Introduction to Data Structures and Algorithms With Python. </title>
      <dc:creator>Samwel Njihia</dc:creator>
      <pubDate>Sun, 20 Feb 2022 10:07:32 +0000</pubDate>
      <link>https://dev.to/samgnjihia/python-102-introduction-to-data-structures-and-algorithms-with-python-32i7</link>
      <guid>https://dev.to/samgnjihia/python-102-introduction-to-data-structures-and-algorithms-with-python-32i7</guid>
      <description>&lt;p&gt;This article is beginner friendly to kick start learning data structure and algorithms using python programming language. This article discusses the in-built data structures such list, tuples, set, dictionaries, and user defined data structures such linked list, graph, trees etc., and algorithms. Data is crucial which means that it needs to be stored and accessed in timely manner (This is archived via data structures). The articles discussed data structured and algorithms in python.&lt;/p&gt;

&lt;h1&gt;
  
  
  Data Structure Definition
&lt;/h1&gt;

&lt;p&gt;Refers to data organization, storage, and data management format that enables efficient modification and access.  Data structure allows organization of data in such a way that storage of data collection, relation and and performance of operation between them is possible.&lt;/p&gt;

&lt;h4&gt;
  
  
  Type of Data Structures in Python
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;The following is a simple breakdown:&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GylKfVtU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/irxu1gyvsmoazy0c5zo2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GylKfVtU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/irxu1gyvsmoazy0c5zo2.png" alt="Types of data Structures" width="880" height="393"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h6&gt;
  
  
  a.) Built-in Data Structures
&lt;/h6&gt;

&lt;p&gt;These structures are called List, Dictionary, Tuple and Set.&lt;/p&gt;
&lt;h5&gt;
  
  
  i.) List
&lt;/h5&gt;

&lt;p&gt;They have positive and negative index, the +ve index starts from 0 and the -ve index starts from -1.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Elements are ordered, changeable and allow duplicates&lt;/li&gt;
&lt;li&gt;Items can be added or removed&lt;/li&gt;
&lt;li&gt;Defined using [] or the list() constructor&lt;/li&gt;
&lt;li&gt;Use dot(.) to get in-build method to perform sort, remove etc&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;my_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="c1"&gt;#empty list
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;my_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'Sam'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;3.132&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;#list with data
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Results:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'Sam'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;3.132&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some of operations that can be performed using List are &lt;em&gt;append&lt;br&gt;
clear&lt;br&gt;
copy&lt;br&gt;
count&lt;br&gt;
extend&lt;br&gt;
insert&lt;br&gt;
index&lt;br&gt;
pop&lt;br&gt;
remove&lt;br&gt;
reverse&lt;br&gt;
sort&lt;/em&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  ii.) Dictionary
&lt;/h5&gt;

&lt;p&gt;They are used to store key value pairs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They are ordered , changeable, and do not allow duplicates(from python 3.7 and above)&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
  
  
  Example:
&lt;/h5&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;my_dict&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="c1"&gt;#empty dictionary
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;my_dict&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'Django'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'Laravel'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;#With elements
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Results:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'Django'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'Laravel'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following are operations that can be performed using Dictoionary&lt;br&gt;
&lt;em&gt;clear()&lt;br&gt;
copy()&lt;br&gt;
values()&lt;br&gt;
update()&lt;br&gt;
fromkeys()&lt;br&gt;
get()&lt;br&gt;
items()&lt;br&gt;
keys()&lt;br&gt;
pop()&lt;br&gt;
popitem()&lt;br&gt;
setdefault()&lt;/em&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  iii.) Tuple
&lt;/h5&gt;

&lt;p&gt;They are the same as lists with the exception that the data once entered into the tuple cannot be changed no matter what.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Items are ordered, unchangeable, and allow duplicates values&lt;/li&gt;
&lt;li&gt;Items can be accessed by referring to the index number, inside square brackets&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
  
  
  Example
&lt;/h5&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"apple"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"banana"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"cherry"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Results:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'apple'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'banana'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'cherry'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  iv.) Sets
&lt;/h5&gt;

&lt;p&gt;They are a collection of unordered elements that are unique. Meaning that even if the data is repeated more than one time, it would be entered into the set only once.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unordered, unchangeable, unindexed, and do not allow duplicate values&lt;/li&gt;
&lt;li&gt;Items in a set cannot be accessed using index but can be accessed using loop
#####Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;num_set&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num_set&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Results:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Operation in set are Union, intersection, Difference etc&lt;/p&gt;

&lt;h4&gt;
  
  
  Example
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;my_set&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;my_set_2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_set&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;union&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_set_2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s"&gt;'----------'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;my_set&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;my_set_2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_set&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;intersection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_set_2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s"&gt;'----------'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;my_set&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;my_set_2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_set&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;difference&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_set_2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s"&gt;'----------'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;my_set&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;my_set_2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_set&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;symmetric_difference&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_set_2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s"&gt;'----------'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;my_set&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="n"&gt;my_set_2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;my_set&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;clear&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_set&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Results:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="err"&gt;———&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="err"&gt;———&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="err"&gt;———&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="err"&gt;———&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  b.) User defined Data Structures
&lt;/h6&gt;

&lt;p&gt;These include Queue, tree, Linked List, Stack, graph, map etc&lt;/p&gt;

&lt;h5&gt;
  
  
  NB Array Vs List
&lt;/h5&gt;

&lt;p&gt;They are the same with one difference. Lists allow heterogeneous data element storage whereas Arrays allow only homogeneous elements to be stored within them.&lt;/p&gt;

&lt;h5&gt;
  
  
  i.) Stacks
&lt;/h5&gt;

&lt;p&gt;They are linear Data Structures which are based on the principle of &lt;em&gt;Last-In-First-Out (LIFO)&lt;/em&gt; where data which is entered last will be the first to get accessed. Built using the array structure and has operations namely, &lt;em&gt;pushing (adding)&lt;/em&gt; elements, &lt;em&gt;popping (deleting)&lt;/em&gt; elements and accessing elements only from one point in the stack called the &lt;em&gt;TOP&lt;/em&gt;.TOP is the pointer to the current position of the stack&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r_ScmULs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/epnpwo08xpyfsr83cd7t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r_ScmULs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/epnpwo08xpyfsr83cd7t.png" alt="Stack" width="212" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Operation in Stacks
&lt;/h5&gt;

&lt;h6&gt;
  
  
  PUSH
&lt;/h6&gt;

&lt;p&gt;Adds an element at the top of the stack&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SIzQJXof--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0l1mt1e544cdg68qelvh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SIzQJXof--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0l1mt1e544cdg68qelvh.png" alt="push" width="487" height="322"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  POP
&lt;/h6&gt;

&lt;p&gt;Removes an element from the top of the stack &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PSGtkcYk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/olape90sbrr0hf1mndde.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PSGtkcYk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/olape90sbrr0hf1mndde.png" alt="pop" width="434" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  ii.) Queue
&lt;/h5&gt;

&lt;p&gt;Is a linear data structure which is based on the principle of &lt;em&gt;First-In-First-Out (FIFO)&lt;/em&gt; where the data entered first will be accessed first.It is built using the array structure and has operations which can be performed from both ends of the Queue, i.e, head-tail or front-back. Operations such as adding and deleting elements are called En-Queue and De-Queue and accessing the elements can be performed.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TC7p-41l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gqiho1ndnhfq9h74rfvo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TC7p-41l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gqiho1ndnhfq9h74rfvo.png" alt="Queue" width="829" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  iii.) Tree
&lt;/h5&gt;

&lt;p&gt;They are non-linear data structure that have roots and node.The root is the node from where the data originates and the nodes are the other data points that are available to us. The node that precedes is the parent and the node after is called the child. There are levels a tree has to show the depth of information. The last nodes are called the leaves.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qjKfl2hh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5gpsdsgrhh2w4d1dc73q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qjKfl2hh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5gpsdsgrhh2w4d1dc73q.png" alt="Trees" width="460" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  iv.) Linked List
&lt;/h5&gt;

&lt;p&gt;Linked lists are linear Data Structures which are not stored consequently but are linked with each other using pointers. The node of a linked list is composed of data and a pointer called next. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZWlMbOnz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jt3hnwqcl3d4lczn7vvx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZWlMbOnz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jt3hnwqcl3d4lczn7vvx.png" alt="Linked lists" width="880" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  v) Graph
&lt;/h5&gt;

&lt;p&gt;Graphs are used to store data collection of points called vertices (nodes) and edges (edges). Graphs can be called as the most accurate representation of a real-world map. They are used to find the various cost-to-distance between the various data points called as the nodes and hence find the least path. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tBvqQGzs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vl1jqsjjbtkjuv7lu3al.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tBvqQGzs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vl1jqsjjbtkjuv7lu3al.png" alt="Grapgh" width="484" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  v) HashMaps
&lt;/h5&gt;

&lt;p&gt;are the same as what dictionaries are in Python. They can be used to implement applications such as phonebooks, populate data according to the lists &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yWmUgqs_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrhn5u3zm0wtd4wv3p8o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yWmUgqs_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrhn5u3zm0wtd4wv3p8o.png" alt="HashMaps" width="354" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  ALGORITHMS
&lt;/h1&gt;

&lt;p&gt;They are instructions or rules that are formulated in a finite sequential order to solver problems and get results. They provide pseudo-code for problems and they are not language specific as they can be implemented in any language.&lt;/p&gt;

&lt;h5&gt;
  
  
  How to write an algorithm
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;Figure out what is the exact problem&lt;/li&gt;
&lt;li&gt;Determine where you need to start&lt;/li&gt;
&lt;li&gt;Determine where you need to stop&lt;/li&gt;
&lt;li&gt;Formulate the intermediate steps&lt;/li&gt;
&lt;li&gt;Review your steps
#####Algorithm Classes:
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fwc_NOZu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yps4pzlb6fdlk67z4mr5.png" alt="Algorithms classes" width="880" height="356"&gt;
Some examples of algorithms include Tree Traversal Algorithms, Searching Algorithms, Sorting Algorithms, etc.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Python 101: Ultimate Python Guide or Introduction to Modern Python</title>
      <dc:creator>Samwel Njihia</dc:creator>
      <pubDate>Sun, 13 Feb 2022 10:42:13 +0000</pubDate>
      <link>https://dev.to/samgnjihia/python-101-ultimate-python-guide-or-introduction-to-modern-python-3oek</link>
      <guid>https://dev.to/samgnjihia/python-101-ultimate-python-guide-or-introduction-to-modern-python-3oek</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Python is a dynamically typed language, i.e., the data type of any variable or function is checked at run time, and due to this, python does not require the definition of data type as in java(Although you can define your data type in python which is not a must). Python is applied in fields such as &lt;em&gt;web development, game development, AI and Machine learning, software development, etc&lt;/em&gt;. The article discusses python's basics and how to get started with the python programming language.&lt;/p&gt;

&lt;h4&gt;
  
  
  Variable Declaration
&lt;/h4&gt;

&lt;p&gt;Variables are containers for storing values of the data.&lt;br&gt;
Example of how to declare and assign values to variable&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = "John"
age = 45
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As seen above there is no data type for each variable but data type for each variable can be done as shown&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;age = int(56) #age will be intenger
height = str(10) #height will be string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;age:int = 56 #age will be intenger
height:str = 10 #height will be string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Data type that a function return can be specified as shown&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def hello() -&amp;gt;int:
return 6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  NB &lt;em&gt;Declaration of datatype is not mostly done&lt;/em&gt;
&lt;/h5&gt;

&lt;h4&gt;
  
  
  Comments
&lt;/h4&gt;

&lt;p&gt;Comment are not executed and they are for code explanation&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Single Line Comments&lt;/em&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# put comment here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;em&gt;Multi-line Comments&lt;/em&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"""
This is a multline
comment
"""
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Data Types
&lt;/h4&gt;

&lt;p&gt;These include int, str, boolean and we have already seen how you can specifies them if you want &lt;/p&gt;

&lt;h4&gt;
  
  
  Data Structures(Collections/Arrays) in Python
&lt;/h4&gt;

&lt;p&gt;These are &lt;em&gt;dictionaries, list, tuples, and sets&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Lists&lt;/em&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Elements are ordered, changeable and allow duplicates&lt;/li&gt;
&lt;li&gt;Items can be added or removed&lt;/li&gt;
&lt;li&gt;Defined using [] or the list() constructor&lt;/li&gt;
&lt;li&gt;Use dot(.) to get in-build method to perform sort, remove etc
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;numbers = [10,23,90] #declaring using []
num =list((1, 4, 6)) #list constructor, note the double brackets
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;em&gt;Sets&lt;/em&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Unordered, unchangeable, unindexed, and do not allow duplicate values&lt;/li&gt;
&lt;li&gt;Items in a set cannot be accessed using index but can be accessed using loop
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;num_set = {1, 3, 6, 70}
print(num_set )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;em&gt;a) Sets Union (|)&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;This combination of everything in the sets&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lettersA = {"A", "B", "C", "D"}
lettersB = {"E", "F"}
print(lettersA | lettersB )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{'A', 'D', 'C', 'E', 'B', 'F'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;em&gt;b) Sets Intersection(&amp;amp;)&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;This what is common between the given sets&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lettersA = {"A", "B", "C", "D"}
lettersB = {"B", "G"}
print(lettersA &amp;amp; lettersB )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{'B'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;em&gt;c) Sets Difference(-)&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;Deference A-B means what is in A and not in B&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lettersA = {"A", "B", "C", "D"}
lettersB = {"B", "E", "F"}
print(lettersA - lettersB )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{'C', 'A', 'D'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;em&gt;Dictionaries&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;They are unordered mutable python container that stores mappings of the unique keys to values&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They are ordered , changeable, and do not allow dublicates(from python 3.7 and above)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;student = {
    "name" : "john",
    "age" : 34,
    "address" : "US"
}

print(student["name"])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;john
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;em&gt;Tuples&lt;/em&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Items are ordered, unchangeable, and allow duplicates values&lt;/li&gt;
&lt;li&gt;Items can be accessed by referring to the index number, inside square brackets
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;names= ("apple", "banana", "cherry")
print(names)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;results&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;('apple', 'banana', 'cherry')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Conditional Statements
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;If Statement&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;Executes is the given condition is true&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a = 4
b = 10
if b &amp;gt; a:
   print("B is greater than A")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;B is greater than A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;em&gt;If ELse Statement&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;if executes when given condition is true and else executes when the condition fails&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;b = 4
a = 10
if b &amp;gt; a:
   print("B is greater than A")
else:
   print("B is not greater than A")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;B is not greater than A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  if---elif--else
&lt;/h4&gt;

&lt;p&gt;used to express multiple conditions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;num = 0

if num &amp;gt; 0:
  print("Number Positive")
elif num == 0:
  print("Number is equal to 0")
else:
  print("Number is negative ")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Number is equal to 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Loops
&lt;/h4&gt;

&lt;p&gt;These are the &lt;em&gt;while&lt;/em&gt; and for &lt;em&gt;loops&lt;/em&gt; and they execute as long as the given condition is true&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;The while loop&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;The following executes as long as i is &amp;lt; 5&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;i = 1
while i &amp;lt; 5:
  print(i)
  i += 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1
2
3
4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  For loop
&lt;/h5&gt;

&lt;p&gt;A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).&lt;br&gt;
The following will print each fruits&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fruits = ["apple", "banana", "mango"]
for x in fruits:
  print(x)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apple
banana
mango
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Functions and Function Call
&lt;/h4&gt;

&lt;p&gt;Function is a block of code that will executes when it is called&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def helloWorld():
  print("Hello code Gurus")

helloWorld()# function Call
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello code Gurus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;em&gt;Passing Parameters and Arguments to Functions&lt;/em&gt;
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Parameters are variables in method while arguments are data passed to the method's parameters&lt;/li&gt;
&lt;li&gt;Arguments is the actual value of the variable that get passed to function
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def helloWorld(name):
  name = 'Hello code Gurus'
  print(name)

helloWorld(name)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello code Gurus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
