<?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: Mercy wanyonyi</title>
    <description>The latest articles on DEV Community by Mercy wanyonyi (@wanyonyi_mwaviki).</description>
    <link>https://dev.to/wanyonyi_mwaviki</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%2F814969%2F4a880543-29c9-487b-98ca-1626fe1fe29e.jpg</url>
      <title>DEV Community: Mercy wanyonyi</title>
      <link>https://dev.to/wanyonyi_mwaviki</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wanyonyi_mwaviki"/>
    <language>en</language>
    <item>
      <title>Introduction to Data Structures and Algorithims with Python</title>
      <dc:creator>Mercy wanyonyi</dc:creator>
      <pubDate>Mon, 21 Feb 2022 22:58:50 +0000</pubDate>
      <link>https://dev.to/wanyonyi_mwaviki/introduction-to-data-structures-and-algorithims-with-python-20oe</link>
      <guid>https://dev.to/wanyonyi_mwaviki/introduction-to-data-structures-and-algorithims-with-python-20oe</guid>
      <description>&lt;p&gt;Data Structures and Algorithims have always been approached with a skeptical attitude of being very hard. It is probaly the terms that scare most people. I have however learnt that the best way is to take a bottom-up approcah: starting from the basic stuff to the complex ones.&lt;/p&gt;

&lt;p&gt;This article will help you understand the basics of data structures and algorithims, their importance and eventually how you can implement them in a real-life situation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Data Structures?
&lt;/h2&gt;

&lt;p&gt;Simply put, Data Structures are ways in which data is organised in order to easily access, manipulate and share it. They therefore allow effective operations in onces code. At the end of this article, you will realise that using the right data structure improves the effectiveness of your code by far.&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisite
&lt;/h4&gt;

&lt;p&gt;In my previous &lt;a href="https://dev.to/wanyonyi_mwaviki/ultimate-python-beginners-guide-13on"&gt;article&lt;/a&gt;, we introduces ourselves to some basic data structures that are a necessary prerequisite to this course. &lt;/p&gt;

&lt;p&gt;The data structures that we will talk about here are categorised into two groups as shown below: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9T5N8FwN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/auca5glthru08fq3852u.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9T5N8FwN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/auca5glthru08fq3852u.jpg" alt="Image description" width="700" height="500"&gt;&lt;/a&gt;&lt;br&gt;
 We shall discuss linear data structures in this article&lt;/p&gt;
&lt;h3&gt;
  
  
  Linear Data Structures
&lt;/h3&gt;

&lt;p&gt;These are structures that work on one data then moves to the next hence the 'linear'. Among them we have:&lt;/p&gt;
&lt;h5&gt;
  
  
  Arrays
&lt;/h5&gt;

&lt;p&gt;In python, Arrays are more or less like lists. However, an array is immutable and contains data of the same type unlike a list can contain different types of data. Arrays are very important data structures especiassly when it comes to recursive functions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sx9fAjIt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nnntxafalxxfrz8xsub6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sx9fAjIt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nnntxafalxxfrz8xsub6.png" alt="Image description" width="858" height="300"&gt;&lt;/a&gt;&lt;br&gt;
The example above is an array of integers with thier indices shown below.&lt;br&gt;
The following are ways ways in which one can manipulate arrays&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'''an array of integers'''
#int array [10]= {1,2,3,4,5,6,7,8,9,10} 
arrayName=[1,2,3,4,5,6,7,8,9,10]

#Adding items to an array
arrayName.append[11]
   print (arrayName)
# 
[1,2,3,4,5,6,7,8,9,10]

#Removing Items from an Array
#removes 1st item
arrayName.remove

#output
#[2,3,4,5,6,7,8,9,10]



#removing item im arr[3]
arrayName.pop[3]

#output
#[1,2,3,5,6,7,8,9,10]

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Linked Lists
&lt;/h3&gt;

&lt;p&gt;Lisked lists are data structures that consist of nodes connected with pointers. These nodes are made up of data and memory location of the next node as shown below:&lt;/p&gt;

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

&lt;p&gt;The first node is called the head node. If the linked list is empty then the value of the head node is "None".If the list is long, we will have access to the other node sequentially starting from the head node.There are however other linked lisyed that can be traversedd differentlty. The last node doesn't contain any address value but it has a data value(×=0).&lt;/p&gt;

&lt;p&gt;Linked lists can be categorised into three groups&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   - Singly Linked List

   - Doubly linked lists

   - Circular Linked List.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Singly Linked List
&lt;/h4&gt;

&lt;p&gt;These are linked that can be accessed only in forward direction starting with the first data.&lt;/p&gt;
&lt;h3&gt;
  
  
  Doubly Linked Lists
&lt;/h3&gt;

&lt;p&gt;In this lists one node has two pointer: one to the next node and the other to the previous node apart from the first and last node.&lt;/p&gt;
&lt;h3&gt;
  
  
  Circular Linked List.
&lt;/h3&gt;

&lt;p&gt;This isa linked list where the head and the last node are connected such that the address value of the last node belongs to the first node. &lt;/p&gt;

&lt;p&gt;The following are ways in which the mentioned linked lists can be implemented.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Singly Linked Lists

#Node class

Class Node:
   def__init__(self, dataval=None)
      self.dataval=dataval
      self.nextval=None


Class SLinkedList:
    def__init__(self)
      self.headval=None
    def PrintList (self)
       printval=self.headval
       While printval is not None:
         print (printval.dataval) #printing the first data value value

          printval=printval.nextval # the first node.


#calling the list

MyList=SlinkedList()
MyList.headval=Node("Mon")
N2=Node("Tue")
N3=Node("Wed")
N4=Node("Thur")
N5=Node("Fri")

#linkng the nodes
MyList.headval.nextval=N2
N2.nextval=N4
N4.dataval=N5

MyList.PrintList()

#Output
Mon
Tue
Wed
Thur
Fri

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Stacks
&lt;/h2&gt;

&lt;p&gt;As the word implies, stacks are structures that store data arranged in a Last-in-First out manner.&lt;br&gt;
One can alter a stack from only one end. Adding and removing items from the stack are carried by the push and pop operations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#creatibg a stack
def stack ():
   stack =[]
  return stack

#Empty stack
def IsEmpty (stack):
    return len (stavk)==0

#adding items
 def push (stack,item):
     stack.append (item)
     Print ("pushed item; "+item)

#removing item
def pop (stack)
    If pop (IsEmpty (stack))
         return "stack is empty"
    return stack.pop ()


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

&lt;/div&gt;



</description>
      <category>python</category>
      <category>algorithms</category>
      <category>datastructures</category>
    </item>
    <item>
      <title>Ultimate Python Beginner's Guide.</title>
      <dc:creator>Mercy wanyonyi</dc:creator>
      <pubDate>Tue, 15 Feb 2022 02:15:44 +0000</pubDate>
      <link>https://dev.to/wanyonyi_mwaviki/ultimate-python-beginners-guide-13on</link>
      <guid>https://dev.to/wanyonyi_mwaviki/ultimate-python-beginners-guide-13on</guid>
      <description>&lt;h1&gt;
  
  
  Everything you need to write your first python code.
&lt;/h1&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%2F7vbs84mx5yyt3m02w82n.jpg" 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%2F7vbs84mx5yyt3m02w82n.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looking at lines of code as a begginer can really scare one off into thinking that programing is hard. Truth is it's neither here or there. Programing is simply the process of converting High-level language, that is easily understood by a human, to a low-level language that a computer can execute. &lt;/p&gt;

&lt;p&gt;The good news is that Python is very easy to learn of most of the languages. Even a child can code in python. Apart from that, it has a lot of applications that you might find interesting. In this article, we will learn all the basic concepts of Python in a very simple way that will help you write your first code! &lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of Python
&lt;/h3&gt;

&lt;p&gt;First of all you may want to know some advantages of Python:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It can work on differnt platforms, ie Wimdoss, Mac, Pi Linux ect.&lt;/li&gt;
&lt;li&gt;It is object oriented&lt;/li&gt;
&lt;li&gt;It has a lot of libraries&lt;/li&gt;
&lt;li&gt;it has a wide range of application &lt;/li&gt;
&lt;li&gt;It is easy to use,&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Applications of Python
&lt;/h3&gt;

&lt;p&gt;You can apply Python in areas like;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Web Development&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AI and Machine Learning&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Game development&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Science&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Audiou and Visual applications&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Software Development&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;You first need to set up a working environment for Python by following the steps below; &lt;/p&gt;

&lt;p&gt;1.Download and install Python from their &lt;a href="https://www.python.org/downloads/" rel="noopener noreferrer"&gt;page&lt;/a&gt;. Make sure you dowmload a version that is compatible with your OS.&lt;/p&gt;

&lt;p&gt;2.Choose a code editor that you will work with and install it. I recommend using Visual Studio Code. You can download it &lt;a href="https://code.visualstudio.com/download" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;3.Confirm whether your python is installed by typing the code below on your Command Prompt.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h1&gt;
  
  
  Basics of Python
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Variables
&lt;/h2&gt;

&lt;p&gt;Variables store information that can be used in one's program. In technical terms, the variable is a memory location assigned some value called a literal. For instance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Variable
a=5
b="Mathew"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a=5      a is the varible ,5 is the literal while in b= "Mathew" b is the variable, Mathew is the literal&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Types
&lt;/h2&gt;

&lt;p&gt;In the example above, there are two types of data used, that is an integer 5, which is a whole number and a string "Mathew".&lt;br&gt;
In python we have several data types;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Numbers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Integers:      Whole numbers   &lt;code&gt;1,3,5,20&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Float:         Numbers with decimals    &lt;code&gt;0.5, 45.6&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Complex :       Numbers with Imaginery parts  &lt;code&gt;2+ 5i&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;String&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A string is an immutable collection of alphabets, characters or words usually denoted with either double or single quotation marks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a= "python"
   Print(a)

OUTPUT
&amp;lt;python&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Boolean&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are two boolean values, &lt;code&gt;True&lt;/code&gt; and &lt;code&gt;False&lt;/code&gt;. They are used to show the truth values of an expression in a code.&lt;br&gt;
For example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a=10
b=5
  Print (b&amp;gt;a)

OUTPUT
&amp;gt;&amp;gt;&amp;gt; False
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Identifiyer
&lt;/h2&gt;

&lt;p&gt;These are names assigned to a variable, class, function or module in python.&lt;br&gt;
 NB. Identifiers are case sensitive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Amount= 122
name= "Mwaviki"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Amount and name are identifiyers in the example above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Structures
&lt;/h2&gt;

&lt;p&gt;These are specific ways in which data is organized in a block of code for effective operations. We have;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lists&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A list in python is a group of items in &lt;code&gt;[]&lt;/code&gt; separated by commas &lt;code&gt;,&lt;/code&gt;. One can manitpulate the list by adding, removing or displaying specific items on the list using the commands 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;MyList= [1,2,3,4,5,6,7]

#Adding to the beginning of thelist
MyList[0]= 0                         OUTPUT 
                                      [0,1,2,3,4,5,6,7]
#Adding at the end
MyList.append(8)                      OUTPUT
                                      [1,2,3,4,5,6,7,8]
#Removing an item
MyList.remove(3)                       OUTPUT
                                      [1,2,4,5,6,7]

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Tuples&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are ordered 'immutable lists'. The contents are inside a &lt;code&gt;()&lt;/code&gt; unlike in a list&lt;code&gt;[]&lt;/code&gt;. With Tuples, one can only display items or delete the whole tuple.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MyTuple= (" Joy"," Grace","Jon"," Macy")
  Print (MyTuple[0:2])

#OUTPUT
("Joy","Grace")

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Sets&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Python a set is an unordered and unchangable collection of data. It can contain several items repreating themselves but will be omitted on printing the set. The items are enclosed in a &lt;code&gt;{}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Myset= {20,20,35,50,45,80,50,95}
Print(Myset)

OUTPUT
{45,35,50,20,80,95}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NB: One can add or remove items from a set.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dictionary&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dictionaries are used to store data values which are paired with key values 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;MyDict={
           "Name":'James'
           "Age":34
           "Location":"Kenya"
           }
Print(MyDict["Age"])

OUTPUT
34
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Operator
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Arithmetic &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Addition          &lt;code&gt;2+5&lt;/code&gt;___________&lt;strong&gt;&lt;em&gt;&lt;code&gt;7&lt;/code&gt;&lt;br&gt;&lt;br&gt;
 Substruction      &lt;code&gt;3-1&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;____________ &lt;code&gt;2&lt;/code&gt;&lt;br&gt;
 Multiplication   &lt;code&gt;2*3&lt;/code&gt;_____________&lt;strong&gt;&lt;em&gt;&lt;code&gt;6&lt;/code&gt;&lt;br&gt;
 Division         &lt;code&gt;10/5&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;_________&lt;strong&gt;&lt;em&gt;&lt;code&gt;2&lt;/code&gt;&lt;br&gt;
 Exponential     &lt;code&gt;2**3&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;__________&lt;strong&gt;&lt;em&gt;&lt;code&gt;16&lt;/code&gt;&lt;br&gt;
 Floor division  &lt;code&gt;11//4&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;__________&lt;strong&gt;&lt;em&gt;&lt;code&gt;2&lt;/code&gt;&lt;br&gt;
 Modulous        &lt;code&gt;11%5&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;______________&lt;code&gt;1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Assignment: Used to assign values to variables. They include:&lt;br&gt;
 &lt;code&gt;=   5=5&lt;br&gt;
  +=  x+=3_______________ x+3&lt;br&gt;
 -=   x-=2_______________ x-2&lt;br&gt;
 *=   x*=3_______________x*3&lt;br&gt;
 /=   x/=1_______________x/1&lt;br&gt;
 **=  x**=2______________ x**2&lt;br&gt;
 //=  x//=4______________x//4&lt;br&gt;
 %=&lt;/code&gt;   x%=5_______________x%5&lt;br&gt;
&lt;code&gt;&amp;amp;=&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Comparison: used to compare values&lt;br&gt;
&lt;code&gt;&amp;lt;&lt;/code&gt;____________&lt;strong&gt;&lt;em&gt;less than&lt;br&gt;
&lt;code&gt;&amp;gt;&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;_________&lt;strong&gt;&lt;em&gt;greater than&lt;br&gt;
&lt;code&gt;&amp;gt;=&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;________&lt;strong&gt;&lt;em&gt;greater or equal to&lt;br&gt;
&lt;code&gt;&amp;lt;=&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;________&lt;strong&gt;&lt;em&gt;less than or equal to&lt;br&gt;
&lt;code&gt;==&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;___________ same/equals ro&lt;br&gt;
&lt;code&gt;!=&lt;/code&gt;______________ not same/equal to&lt;/p&gt;

&lt;p&gt;Bitwise:Used to write numbers in binary&lt;br&gt;
`&amp;amp;_____________&lt;strong&gt;&lt;em&gt;and&lt;br&gt;
|&lt;/em&gt;&lt;/strong&gt;___________&lt;strong&gt;&lt;em&gt;OR&lt;br&gt;
&amp;lt;&amp;lt;&lt;/em&gt;&lt;/strong&gt;_____________ a&amp;lt;&amp;lt;b shit bits of a to the left by b bits &lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;_____________&lt;strong&gt;&lt;em&gt;a&amp;gt;&amp;gt;b shift bits of a to the right by b units&lt;br&gt;
~&lt;/em&gt;&lt;/strong&gt;___________&lt;strong&gt;&lt;em&gt;NOT&lt;br&gt;
^`&lt;/em&gt;&lt;/strong&gt;______________XOR&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;

&lt;p&gt;Identity: used to determine whether two objects are the same. &lt;br&gt;
&lt;code&gt;is, is not&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Logical: Used to combine conditional statements.&lt;br&gt;
&lt;code&gt;and&lt;/code&gt;&lt;br&gt;
&lt;code&gt;or&lt;/code&gt; &lt;br&gt;
&lt;code&gt;not&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Functions
&lt;/h2&gt;

&lt;p&gt;There are two types of functions in Python&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built-in Functions
These are functions that aready exist in Python and have a specific purpose. There are more that 50 built in functions with the mostly used beind such as &lt;code&gt;Print&lt;/code&gt;,&lt;code&gt;Input&lt;/code&gt; etc.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Print("Hello World")

OUTPUT
Hello World

name= Input(" What is your name?: )
Print("Hi {name}")

OUTPUT
What is your age?: John(as an input) 
Hi John

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

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Calling a function &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Other functions in python are a block of code that runs only when called upon. To define a function one starts with &lt;code&gt;def&lt;/code&gt; functionname followed with parameters in the function (parameters) as shown in the example below.&lt;br&gt;
A function must return some results whenever is called upon.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#The function has nothing to return
def MyFunc()
      return           

#Function is called  
MyFunc()  


def My2Func() 
  Print( "This is my function")


#Function is called
My2Func()

#OUTPUT
This is my function

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Comments
&lt;/h2&gt;

&lt;p&gt;You can write comments in your code to help you organise your work in two ways. Comments would be skipped when the code is being run.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single line comment: putting a &lt;code&gt;#&lt;/code&gt; before the line&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;#this is my comments&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Block comment: Using three double quotation make at the start and end of code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"""a= "Commenting a block of code"
   Print(a)
"""
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Loops and Condition statements&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;For loops
This loop is used to iterate over a sequence once for an item according the the set statements. For instance
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Numb= [1,5,10,]
For x in Numb
 Print (X)

OUTPUT
X:5
&amp;gt;&amp;gt;5

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;While loop
This loop is will run the set statements until a certain condition is met.
&lt;/li&gt;
&lt;/ul&gt;

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

While n &amp;lt;= 10
  Print (n)
n+=1

#OUTPUT
(0,1,2,3,4,5,6,7,8,9,10)

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If statement
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a=15
b=10

If a&amp;gt;b
  Print ("a is greater than b")

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If...else
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a= "Rain"

If a
 print ("Stay")
else:
  Print("Go")

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;elif&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the prevision condition is not met then move to the next one.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a=15
b=10

if b&amp;gt;a
  print ("b is greater than a")
elif b&amp;lt;a
  print ("b is less than a")

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

&lt;/div&gt;



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

&lt;p&gt;By now you shoul be able to write your first Python Code and so much more. You can go through the &lt;a href="https://www.python.org/dev/peps/pep-0008/" rel="noopener noreferrer"&gt;PEP-8&lt;/a&gt; guide to get more guidance on how best to write your python code.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>firstcode</category>
    </item>
  </channel>
</rss>
