<?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: Kipkurui Evans Langat</title>
    <description>The latest articles on DEV Community by Kipkurui Evans Langat (@langat20).</description>
    <link>https://dev.to/langat20</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%2F852284%2Fce09b469-0279-4a71-8abc-decc510116e4.jpeg</url>
      <title>DEV Community: Kipkurui Evans Langat</title>
      <link>https://dev.to/langat20</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/langat20"/>
    <language>en</language>
    <item>
      <title>Python programming for beginners</title>
      <dc:creator>Kipkurui Evans Langat</dc:creator>
      <pubDate>Sat, 23 Apr 2022 20:30:02 +0000</pubDate>
      <link>https://dev.to/langat20/python-programming-for-beginners-pi5</link>
      <guid>https://dev.to/langat20/python-programming-for-beginners-pi5</guid>
      <description>&lt;h2&gt;
  
  
  What is python?
&lt;/h2&gt;

&lt;p&gt;Python is a high-level, object-oriented programming language. Most beginners in the development field prefer Python as one of the first languages to learn because of its simplicity and versatility.&lt;/p&gt;

&lt;h2&gt;
  
  
  Executing the Python program.
&lt;/h2&gt;

&lt;p&gt;take for example we have created a file named main.py and we want to run it we will do the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Python3 main.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating Functions in Python
&lt;/h2&gt;

&lt;p&gt;for example : if we want to create a function to add two variables&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_10&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;numbers&lt;/li&gt;
&lt;li&gt;strings&lt;/li&gt;
&lt;li&gt;boolean&lt;/li&gt;
&lt;li&gt;tuples&lt;/li&gt;
&lt;li&gt;lists&lt;/li&gt;
&lt;li&gt;dictionaries&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  control statements
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;for loop&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&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;/p&gt;

&lt;p&gt;eg. &lt;br&gt;
Print each fruit in a fruit list:&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="n"&gt;fruits&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;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;fruits&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;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;if statement&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If statement:&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="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;33&lt;/span&gt;
&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;a&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="s"&gt;"b is greater than a"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Applications of Python.
&lt;/h2&gt;

&lt;p&gt;Artificial Intelligence&lt;br&gt;
Desktop Application&lt;br&gt;
Automation&lt;br&gt;
Web Development&lt;br&gt;
Data Wrangling, Exploration And Visualization.&lt;/p&gt;

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