<?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: Josh</title>
    <description>The latest articles on DEV Community by Josh (@joshwaoti).</description>
    <link>https://dev.to/joshwaoti</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%2F812013%2F303ac542-1d0f-442e-be59-2574545de0d4.jpeg</url>
      <title>DEV Community: Josh</title>
      <link>https://dev.to/joshwaoti</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joshwaoti"/>
    <language>en</language>
    <item>
      <title>Debunking the Fear: Why AI Will Never Replace Our Jobs</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Sat, 26 Aug 2023 14:02:08 +0000</pubDate>
      <link>https://dev.to/joshwaoti/debunking-the-fear-why-ai-will-never-replace-our-jobs-2b4o</link>
      <guid>https://dev.to/joshwaoti/debunking-the-fear-why-ai-will-never-replace-our-jobs-2b4o</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
The rise of artificial intelligence (AI) has sparked concerns about its potential to replace human jobs across various industries. The fear of automation and AI rendering human skills obsolete has been propagated through media, tech CEOs, and experts. However, this article aims to debunk this apprehension by delving into historical precedents, the nature of human work, and the limitations of AI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7_Wnomd4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/531fdtc1abgz06l36xhn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7_Wnomd4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/531fdtc1abgz06l36xhn.jpg" alt="AI operating a computer, Unsplash" width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The AI Job Apocalypse: A Flawed Notion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The widespread notion that AI will completely replace jobs is grounded in sensationalism and misunderstanding. Media headlines and claims by prominent figures like Elon Musk and Sundar Pichai have contributed to this unfounded fear. However, historical patterns of human adaptation suggest otherwise. From the agricultural revolution to the advent of electricity and smartphones, humans have continually evolved their roles in response to technological advancements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Title: Debunking the Fear: Why AI Will Never Replace Our Jobs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The rise of artificial intelligence (AI) has sparked concerns about its potential to replace human jobs across various industries. The fear of automation and AI rendering human skills obsolete has been propagated through media, tech CEOs, and experts. However, this article aims to debunk this apprehension by delving into historical precedents, the nature of human work, and the limitations of AI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The AI Job Apocalypse: A Flawed Notion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The widespread notion that AI will completely replace jobs is grounded in sensationalism and misunderstanding. Media headlines and claims by prominent figures like Elon Musk and Sundar Pichai have contributed to this unfounded fear. However, historical patterns of human adaptation suggest otherwise. From the agricultural revolution to the advent of electricity and smartphones, humans have continually evolved their roles in response to technological advancements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Human Resilience Throughout History&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Looking back at human history, the transformative shifts brought by inventions such as agriculture, electricity, and the internet have always generated new opportunities and fields of work. Even jobs that were previously unimaginable have become the norm. The argument that AI's rapid pace of progress is unprecedented falls short when compared to past technological leaps. Every groundbreaking technology faced initial resistance, yet society ultimately adapted and thrived.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Failed Prophecy of Factory Automation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before AI, concerns about automation's impact on factory jobs were rampant. However, the predicted massive job loss did not materialize. Factory employment did decline over decades, but not at the alarming rate initially projected. Robots struggled with handling nuances and exceptions that humans managed with ease. The case of Elon Musk's automated Tesla factory demonstrates that even in repetitive tasks, robots often fall short due to their inability to navigate unpredictable scenarios.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Fallacy of Job Deficit&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The notion that AI will create fewer jobs than it replaces is overly pessimistic. Similar concerns were raised during the early days of the internet, yet the tech revolution has ushered in unforeseen opportunities. New industries have emerged, giving rise to a new class of tech entrepreneurs, employees, and investors. Just as the internet created massive economic growth and job prospects, AI is poised to open up new horizons that we cannot currently predict.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Unending Pursuit of Progress&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Human nature dictates an insatiable quest for progress. As long as humans continue to aspire for more, there will always be a demand for innovation, creativity, and problem-solving. AI's role is to enhance human capabilities, not replace them entirely. Tasks that require nuance, empathy, creativity, and adaptation are areas where humans will remain indispensable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The fear of AI completely replacing human jobs is based on a flawed understanding of history, human ingenuity, and the limitations of current AI technologies. Throughout history, humans have always found ways to adapt and thrive in the face of technological shifts. Rather than ushering in a jobless dystopia, AI is likely to create novel opportunities, industries, and economic growth. The partnership between humans and AI is not one of competition, but of mutual empowerment and progress.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>developers</category>
    </item>
    <item>
      <title>Python Itertools Module.</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Tue, 05 Apr 2022 13:00:48 +0000</pubDate>
      <link>https://dev.to/joshwaoti/python-itertools-module-2lh9</link>
      <guid>https://dev.to/joshwaoti/python-itertools-module-2lh9</guid>
      <description>&lt;p&gt;Modules in python are very important and help a very great deal when it comes to programming. For more information about modules, &lt;a href="https://dev.to/joshwaoti/python-libraries-modules-and-packages-gp6"&gt;check here&lt;/a&gt;. In this article, we'll focus on an exciting python module called Itertools.&lt;/p&gt;

&lt;p&gt;First, let's define an iterable and an iterator.&lt;/p&gt;

&lt;p&gt;Iterable is a function that has the &lt;strong&gt;iter&lt;/strong&gt;() method on it.&lt;br&gt;
Iterator is a function that has a &lt;strong&gt;next&lt;/strong&gt;() method on it.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Infinite Iterators
&lt;/h3&gt;

&lt;p&gt;They can return an infinite sequence by using a generator sequence. &lt;br&gt;
Infinite iterators have several functions, we'll look at a few.&lt;/p&gt;
&lt;h4&gt;
  
  
  i. count
&lt;/h4&gt;

&lt;p&gt;This functions as the name suggests, counts through iterable items.&lt;/p&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="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;itertools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;count_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;step&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;counter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;step&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;c&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;counter&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;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;break&lt;/span&gt;

&lt;span class="n"&gt;count_example&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;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="s"&gt;'''
The output:
10
15
20
25
30
35
40
45
50
55
60
65
70
75
80
85
90
95
100
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This is an infinite sequence, that is why we've had to break it at 100. otherwise it would have continued counting infinitely.&lt;/p&gt;
&lt;h4&gt;
  
  
  ii. repeat
&lt;/h4&gt;

&lt;p&gt;The repeat function takes in an element, it could be a string, a list or any iterable element and the maximum number of time you want to repeat something, the maximum number argument is optional. However if you don't provide it the loop will run infinitely. &lt;/p&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="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;itertools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;repeat&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;repeat_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;element&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_repeats&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;repeater&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;repeat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;element&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_repeats&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;val&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;repeater&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;val&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;repeat_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'hello'&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="s"&gt;'''
the output:
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;It is clear that it repeats the hello function 10 times, because we input 10 as the maximum number.&lt;/p&gt;
&lt;h4&gt;
  
  
  iii. cycle
&lt;/h4&gt;

&lt;p&gt;This one takes the iterable of object a string, list, tuple or any iterable object and cycles through them infinitely unless you provide the maximum number of times you want the cycle to go.&lt;/p&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="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;itertools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;cycle&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;cycle_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;elements&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;cycler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cycle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;elements&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;100&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="nb"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cycler&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="o"&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;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="n"&gt;cycle_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'ABCDEF'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="s"&gt;'''
The output:
A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D E F A B C D
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We called the (next()) method on the cycler iterator object manually or we could use a for loop.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Terminator Iterators
&lt;/h3&gt;

&lt;p&gt;These one have a definite number of iterators that they will return to you. In simpler terms, they are not infinite.&lt;br&gt;
Examples of functions that are terminator iterators:&lt;/p&gt;
&lt;h4&gt;
  
  
  i. accumulate
&lt;/h4&gt;

&lt;p&gt;These function gives you the sum of elements of items at current position and prior in the list.&lt;/p&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="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;itertools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;accumulate&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;accumulate_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;elements&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;running_sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;accumulate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;elements&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="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;running_sum&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;accumulate_example&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="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;9&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="s"&gt;'''
The output:
[1, 3, 6, 10, 15, 21, 28, 36, 45, 55]
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Using the accumulate method, we called the list function manually.&lt;/p&gt;

&lt;p&gt;You can as well produce the same result by using a for loop, the advantage of itertools is that they don't store the values in memory, you can call the function to give you the values when you want to use them but it doesn't store the values in space therefore it preserves much memory.&lt;/p&gt;
&lt;h4&gt;
  
  
  ii. Chain
&lt;/h4&gt;

&lt;p&gt;This function chains iterable objects together.&lt;/p&gt;
&lt;h5&gt;
  
  
  Example 1 :
&lt;/h5&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;itertools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;chain&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;chain_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;elements1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;elements2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;chained&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chain&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;elements1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;elements2&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="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chained&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;chain_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"456"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="s"&gt;'''
The output:
['1', '2', '3', '4', '5', '6']
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;It is important to note that this method does not concatenate the items, but it it returns two iterators, it allows you to retrieve single items from the items.&lt;/p&gt;

&lt;p&gt;We also have another method from the chain function called chain_from_iterable. Let's see an example of this:&lt;/p&gt;
&lt;h5&gt;
  
  
  Example 2:
&lt;/h5&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;itertools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;chain&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;chain_from_iterable_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterable&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;chained&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;from_iterable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterable&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="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chained&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;chain_from_iterable_example&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="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;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&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;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt;
&lt;span class="s"&gt;'''
The output:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The method flattens our chained items and returns each single item in a single list.&lt;/p&gt;
&lt;h4&gt;
  
  
  iii. compress
&lt;/h4&gt;

&lt;p&gt;This function takes in form of data source and selector and returns all the data if the corresponding items in the selector is true.&lt;/p&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="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;itertools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;compress&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;compress_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;selectors&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;compressed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;compress&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;selectors&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="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;compressed&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;compress_example&lt;/span&gt;&lt;span class="p"&gt;([[&lt;/span&gt;&lt;span class="s"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"c"&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;3&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;]],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="s"&gt;'''
The output:
[['a', 'b', 'c']]
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;True in this example means that we're keeping corresponding elements while false means we're not keep the correspoding elements.&lt;/p&gt;
&lt;h4&gt;
  
  
  iv. Pairwise
&lt;/h4&gt;

&lt;p&gt;This one si going to pair all the adjacent items in our iterables.&lt;/p&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="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;itertools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pairwise&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;pairwise_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterable&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;paired&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pairwise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterable&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="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;paired&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;pairwise_example&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="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;9&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="s"&gt;'''
The output:
[(1,2),(3,4),(5,6)(7,8),(9,10)]
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  3. Combinatoric Iterators
&lt;/h3&gt;
&lt;h4&gt;
  
  
  i. Product
&lt;/h4&gt;

&lt;p&gt;It returns the cartesian product of two iterable objects. it is kind of nested for loop.&lt;/p&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="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;itertools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;product&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;product_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterable1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;iterable2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;product&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterable1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;iterable2&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="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;product_example&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="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="s"&gt;'''
The output:
[(1, 'a'), (1, 'b'), (1, 'c'), (2, 'a'), (2, 'b'), (2, 'c'), (3, 'a'), (3, 'b'), (3, 'c')]
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  ii. permutations
&lt;/h4&gt;

&lt;p&gt;It returns all the permutations of a particular size of an iterable object.&lt;/p&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="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;itertools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;permutations&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;permutaions_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;permutations&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&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="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;permutaions_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"ABCD"&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;'''
The output:
[('A', 'B'), ('A', 'C'), ('A', 'D'), ('B', 'A'), ('B', 'C'), ('B', 'D'), ('C', 'A'), ('C', 'B'), ('C', 'D'), ('D', 'A'), ('D', 'B'), ('D', 'C')]
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  iii. combinations
&lt;/h4&gt;

&lt;p&gt;It returns all the combinations of a particular size of an iterable object.&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="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;itertools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;combinations&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;permutaions_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;combinations&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iterable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&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="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;permutaions_example&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"ABCD"&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;'''
The output:
[('A', 'B'), ('A', 'C'), ('A', 'D'), ('B', 'C'), ('B', 'D'), ('C', 'D')]
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference between combination and permutations is that in combinations the ordering does not matter. i.e. ('A', 'B') and ('B', 'A') are the same while in permutations they are not the same.&lt;/p&gt;

&lt;p&gt;The fun part of the itertools is when you start mixing them out. You can combine infinite iterators with terminator or combinatoric iterators, or whichever order and with the desiring you want to have them appear.&lt;/p&gt;

&lt;p&gt;There are numerous itertools functions mot mentioned in this article, feel free to check them out in the &lt;a href="https://docs.python.org/3/library/itertools.html"&gt;itertools&lt;/a&gt; documentation and have fun😊 exploring the itertools module.&lt;/p&gt;

</description>
      <category>python</category>
      <category>tutorial</category>
      <category>productivity</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>Python Libraries, modules and packages.</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Mon, 04 Apr 2022 11:49:32 +0000</pubDate>
      <link>https://dev.to/joshwaoti/python-libraries-modules-and-packages-gp6</link>
      <guid>https://dev.to/joshwaoti/python-libraries-modules-and-packages-gp6</guid>
      <description>&lt;p&gt;Python is an interesting programming language, It doesn't let you to code up everything from scratch. You are allowed use already built-in code&lt;br&gt;
to work your way through various tasks. This built-in codes are organized as modules, libraries or packages. This article is dedicated to acquaint you with the knowledge needed to work with them. &lt;/p&gt;

&lt;p&gt;First we'll look at each and understand what they are and how they are used.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Script
&lt;/h3&gt;

&lt;p&gt;A script is a python file that has python code written in it. A script can run and perform the functions that are written in it. If you open an editor and write code and save it as a python file, that is a script. You don't use functions and classes in scripts.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Module
&lt;/h3&gt;

&lt;p&gt;A module is a python file with written code in it and can be imported into a script. A module is simply a block of related code saved in a file with the extension .py. When imported, the functions in the module work with your code to produce the intended result. Modules can also be imported into other modules. Modules can involve the use of functions and scripts.&lt;/p&gt;

&lt;p&gt;For example, let's define a function that says hello when called:&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;hello&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;"Hi there!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can save the file as hello.py. If you want to call the function in script, you simply use the keyword &lt;strong&gt;import&lt;/strong&gt; followed by the name of the file you just saved or the file you want to use in your code. That is, &lt;strong&gt;import hello&lt;/strong&gt;. Then you can now call the function in your code in this script you are currently writing. ie&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="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;hello&lt;/span&gt;

&lt;span class="c1"&gt;# Now we can call the function
&lt;/span&gt;&lt;span class="n"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output of the code will be: Hi there!&lt;/p&gt;

&lt;p&gt;A perfect example of a module would be the random module, which is perfect when handling logic that needs error.&lt;/p&gt;

&lt;p&gt;Modules have numerous benefits into any Python code:&lt;/p&gt;

&lt;p&gt;They improve the development process. Python modules help you focus on one small portion of a task rather than an entire problem. This simplifies the development process and makes it less prone to errors. Furthermore, modules are usually written in a way that minimizes interdependency. Thus, it’s more viable for a team of several programmers to work on the same application. The functionality you define in one module can be used in different parts of an application, minimizing duplicate code.&lt;br&gt;
Separate namespaces. With Python modules, you can define separate namespaces to avoid collisions between identifiers in different parts of your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Package
&lt;/h3&gt;

&lt;p&gt;A package is a collection related modules that work together to provide a certain functionality. The modules are contain within a folder and can imported as well. So a package as the make suggests "packages" numerous modules in a folder, what makes it a package and not a normal folder is the inclusion of a file called the _&lt;em&gt;init&lt;/em&gt;_.py file that tells python that it is a package. Packages allow the hierarchical structure of the module namespace. The same way we organize our files on a hard drive into folders and &lt;br&gt;
sub-folders, we can organize our modules into packages and sub packages. &lt;/p&gt;

&lt;p&gt;Examples of the most common packages&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://numpy.org/doc/"&gt;NumPy&lt;/a&gt;, which is used widely by data scientists.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://pandas.pydata.org/docs/"&gt;Pandas&lt;/a&gt;, pandas is a Python package for fast and efficient processing of tabular data, time series, matrix data, etc.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.pytest.org/en/6.2.x/contents.html"&gt;Pytest&lt;/a&gt;, Pytest contains modules that are essential when you  want to test your code.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Library
&lt;/h3&gt;

&lt;p&gt;Python library contains a collection of related modules and packages. Sometimes this term is often used interchangeably with “Python package” because packages can &lt;br&gt;
also contain modules and other packages (sub packages). However, it is often assumed that while a package is a collection of modules, a library is a collection of packages.&lt;/p&gt;

&lt;p&gt;Mostly, developers create Python libraries to share reusable code with the community to eliminate the need for writing code from scratch. When another developer is working on the same kind of project, they use this libraries.&lt;/p&gt;

&lt;p&gt;Some of these libraries are referred to as open source projects, meaning you as a developer can contribute to the building of such with your chunk of code, improving the functionalities of the library.&lt;/p&gt;

&lt;p&gt;Examples of libraries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://matplotlib.org/stable/"&gt;Matplotlib&lt;/a&gt; library is a standard library for generating data visualizations in Python. It supports building basic two-dimensional graphs as well as more complex animated and interactive visualizations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://pytorch.org/docs/stable/index.html"&gt;PyTorch&lt;/a&gt; is an open-source deep-learning library built by Facebook’s AI Research lab to implement advanced neural networks and cutting-edge research ideas in industry and academia.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.pygame.org/docs/"&gt;Pygame&lt;/a&gt; provides developers with tons of convenient features and tools to make game development a more intuitive task.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.python-requests.org/"&gt;Requests&lt;/a&gt; is a part of a large collection of libraries designed to make Python HTTP requests simpler. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/"&gt;Beautiful Soup&lt;/a&gt; is a very popular Python library for getting data from the web. The modules and packages inside this library help extract useful information from HTML and XML files.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some packages mentioned above are also referred to as libraries, like NumPy and Pandas.&lt;br&gt;
Depending on what your are working on or the areas of your interest, you can use the modules, packages or libraries.&lt;br&gt;
Use the links provided in this article to check out the modules, packages or libraries. You can always also visit the &lt;a href="https://docs.python.org/"&gt;python documentation&lt;/a&gt; more information.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Python for Everyone: Mastering Python the right way</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Thu, 03 Mar 2022 11:30:24 +0000</pubDate>
      <link>https://dev.to/joshwaoti/pyhton-for-everyonemastering-python-the-right-way-34nj</link>
      <guid>https://dev.to/joshwaoti/pyhton-for-everyonemastering-python-the-right-way-34nj</guid>
      <description>&lt;p&gt;Python is a very important language and we cannot overemphasize how important it is to learn it. In this article, I'll shed light on how to master python the right way. Like any other art, there is the right way to learn and master python. Foundational things have to come up first followed by advanced the professional skills are put in place. There are myriads of ways to learn python and&lt;br&gt;
it all depends with the one learning entirely. It is hard to esteem some ways of learning above others. Seemingly, there is a pattern, a roadmap, that provides the best strategy of mastering python while maximizing time.&lt;/p&gt;

&lt;p&gt;I'll discuss the four important steps to take in mastering python which are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Learn the basics of python.&lt;/li&gt;
&lt;li&gt;Identify why you want to learn python.&lt;/li&gt;
&lt;li&gt;Choose an online course.&lt;/li&gt;
&lt;li&gt;Create milestones.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;1. Learn the basics of python.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Learning the basics of any programming language can be challenging and you'll be tempted to skip and go for the "complex" stuff&lt;br&gt;
but just don't rush yourself. It's possible to learn things very fast but in order for something to be stored in you long term&lt;br&gt;
memory, this is something you do, repeatedly, consistently and deliberately. Don't procrastinate, don't rush and skip courses. There are many resources shared in this article for basics of python.  &lt;a href="https://dev.to/joshwaoti/python-101-introduction-to-modern-python-1h7a"&gt;My first article&lt;/a&gt; . You can also watch the following video to get more about python basics &lt;iframe width="710" height="399" src="https://www.youtube.com/embed/kqtD5dpn9C8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Identify why you want to learn python.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this article, &lt;a href="https://dev.to/joshwaoti/python-101-introduction-to-modern-python-1h7a"&gt;Introduction to python&lt;/a&gt;, we talked about how python is a choice programming language and its advantages. This and more information&lt;br&gt;
is a quick step in determining that python is the language you want to learn. Your purpose for choosing python is an elementary &lt;br&gt;
tool, you must be acquainted with why you want to learn python. This will be a motivation and also it will give you direction&lt;br&gt;
on which materials to use while learning. Python is widely used and as a beginner you must narrow down and begin from the basics&lt;br&gt;
following through your purpose; what you want to do with python.&lt;br&gt;
Though it is possible to learn all of them, it's crucial to choose one and work on that one until you are ready to learn the next. It's not advisable to try all of them at the same time.&lt;br&gt;
Majorly, Python is used in these three fields of development;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;i. Web development&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Python is used to build backends of websites. It is comprised of frameworks that make this process fast and simple. A framework in programming is a tool that provides ready-made components or solutions that are customized in order to speed up development. &lt;br&gt;
There are several frameworks in python. One thing to note though is that there is no better framework than the other, you choose&lt;br&gt;
a framework based on the kind of task you want to do and the community that backs that framework. Each framework is built for different tasks. Every framework has a documentation, this is a website or community containing the release notes or rather tutorials. They are for reference and research when working on a project or studying and you should not try to memorize them.&lt;br&gt;
The three most common frameworks for web development are:&lt;/p&gt;

&lt;h5&gt;
  
  
  Django
&lt;/h5&gt;

&lt;p&gt;Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. &lt;a href="https://docs.djangoproject.com/en/4.0/"&gt;Django documentation&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Flask
&lt;/h5&gt;

&lt;p&gt;Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. &lt;a href="https://flask.palletsprojects.com/en/2.0.x/"&gt;Flask documentation&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  FastAPI
&lt;/h5&gt;

&lt;p&gt;FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints. &lt;a href="https://fastapi.tiangolo.com/"&gt;FastAPI documentation&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;ii. AI and Machine Learning&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Artificial intelligence is a technology that enables a machine to simulate human behavior. Machine learning is a subset of AI which allows a machine to automatically learn from past data without programming explicitly. Data Science and data analysis also falls in this docket. Python has also modules and libraries that make this process vary easy. Since machine learning involves the use of a lot of data&lt;br&gt;
python has modules like;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pandas, &lt;/li&gt;
&lt;li&gt;numpy, &lt;/li&gt;
&lt;li&gt;matplotlib&lt;/li&gt;
&lt;li&gt;tensor flow&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;iii. Game Development&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Python is also used for game development. Python language has proved to be an exceptional choice by the developers for rapid prototyping of video games. Here you'll come across the following python libraries for building graphical&lt;br&gt;
user interfaces(GUI) and games:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;turtle&lt;/li&gt;
&lt;li&gt;tkinter&lt;/li&gt;
&lt;li&gt;pygame&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Choose an online course&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;After identifying why you want to learn python and what you want to build using python, I'll guide you through the courses available online that will catapult your progress. The mode of learning this courses is entirely up to you, you can use videos or documentations or both.&lt;/p&gt;

&lt;h5&gt;
  
  
  There are websites that provide online courses for free like
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://www.freecodecamp.org/news/learning-%20&amp;lt;br&amp;gt;%0A%20%20python-from-zero-to-hero-120ea540b567/"&gt;freecodecamp&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  There are courses on udemy:
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This course is for machine learning, i contains all the necessary skills for python to get you started in machine learning and &lt;br&gt;
AI. &lt;a href="https://www.udemy.com/course/python-for-data-science-and-machine-learning-bootcamp/"&gt;Python for Data Science and Machine Learning Bootcamp&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This course will take you through web development using the django framework. &lt;a href="https://www.udemy.com/course/python-and-django-full-stack-web-developer-bootcamp/"&gt;Development&lt;br&gt;
Web Development&lt;br&gt;
Django&lt;br&gt;
Python and Django Full Stack Web Developer Bootcamp&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  There are also books containing information on development, like;
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.amazon.com/Game-Development-Python-Kevin-OFlaherty/dp/0990402088"&gt;Game Development with Python&lt;/a&gt; for game developers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://g.co/kgs/odmeCk"&gt;Python tricks A buffet of awesome python features&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mB2zQT6e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://encrypted-tbn3.gstatic.com/images%3Fq%3Dtbn:ANd9GcRbV4vn4u8ZblwERAXrLOAYkKvTB_vNZFC_0amLcJAEBGRbpTPK" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mB2zQT6e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://encrypted-tbn3.gstatic.com/images%3Fq%3Dtbn:ANd9GcRbV4vn4u8ZblwERAXrLOAYkKvTB_vNZFC_0amLcJAEBGRbpTPK" alt="book cover" width="267" height="400"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Python Workshop starts by showing you how to correctly apply Python syntax to write simple programs, and how to use appropriate Python structures to store and retrieve data. You'll see how to handle files, deal with errors, and use classes and methods to write concise, reusable, and efficient code. &lt;a href="https://www.packtpub.com/product/the-python-workshop/9781839218859"&gt;The Python Workshop&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Eu3pEquo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://static.packt-cdn.com/products/9781839218859/cover/smaller" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Eu3pEquo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://static.packt-cdn.com/products/9781839218859/cover/smaller" alt="book cover" width="250" height="309"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-By the end of the book, you will have a thorough understanding of how to think about and apply object-oriented principles using Python syntax and be able to confidently create robust and reliable programs. &lt;a href="https://www.packtpub.com/product/python-object-oriented-programming-fourth-edition/9781801077262"&gt;&lt;br&gt;
Python Object-Oriented Programming - Fourth Edition&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7or2qOge--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://static.packt-cdn.com/products/9781801077262/cover/smaller" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7or2qOge--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://static.packt-cdn.com/products/9781801077262/cover/smaller" alt="" width="250" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You are free to use other available material on the web.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Introduction to Data Structures and Algorithms</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Mon, 21 Feb 2022 08:15:36 +0000</pubDate>
      <link>https://dev.to/joshwaoti/introduction-to-data-structures-and-algorithms-eg9</link>
      <guid>https://dev.to/joshwaoti/introduction-to-data-structures-and-algorithms-eg9</guid>
      <description>&lt;p&gt;This article is written to this end, that you have a generic view of what data structures and algorithms is in python. Data structures can be classified in two categories;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Built-in data structures&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;User-built data structures&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Built-in data structures&lt;/strong&gt;&lt;br&gt;
This are structures built-in the function that allows us to store, manage and organize data. In this article we'll focus on four; list, tuple, set, and dictionary.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;LIST&lt;/em&gt;&lt;br&gt;
Lists are used to store multiple items in a single variable. The list can contain strings or integers. The contents of a list are written inside square brackets, []. The list is mutable and ordered.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_list = [1,2,3,4,5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After assigning values to a list variable, we can access values by their indexes. Example in the list above,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_list[0] 
#this will access the first item in the list.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;TUPLE&lt;/em&gt;&lt;br&gt;
Tuples are very similar to lists but they are unmuttable. You cannot add or remove elements from a tuple. Tuples are ordered and are written inside ()&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_tupple = (1,2,3,4,5,6)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tuple items can also be accessed by index.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_tuple[3]
# This will access the fourth item which is 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;SET&lt;/em&gt;&lt;br&gt;
A set contains unique items. Set items cannot be accessed by index since they are unordered.&lt;br&gt;
Let's create a list and pass it into a set for unique values&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_list = [1,2,3,1,1,1,6,5,5,7,6,3,4]

my_set = set(my_list)

print(my_list)

#The output will be:
#(1,2,3,4,5,6,7)

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;DICTIONARY&lt;/em&gt;&lt;br&gt;
Dictionaries are unordered collection of items. it allows storing a pair items, keys and values.&lt;/p&gt;

&lt;p&gt;To access an item value in a dictionary, you use its key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'''
this example shows the rating in number of stars of famous games.
to use the rating of NFS for example, we call the index at NFS.
'''
my_dict = {'GTA':4, 'NFS':5, 'PUBG':4}


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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;User-built data structures&lt;/strong&gt;&lt;br&gt;
Here we'll focus on queues, stacks and linked lists.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;QUEUES&lt;/em&gt;&lt;br&gt;
Queue is a linear data structure that stores items in First In First Out (FIFO) manner. &lt;br&gt;
With a queue the least recently added item is removed first. A good example of queue &lt;br&gt;
is any queue of consumers for a resource where the consumer that came first is served first.&lt;/p&gt;

&lt;p&gt;Characteristics of queues&lt;/p&gt;

&lt;p&gt;Two ends:&lt;br&gt;
front → points to starting element&lt;br&gt;
rear → points to the last element&lt;/p&gt;

&lt;p&gt;There are two operations:&lt;br&gt;
enqueue → inserting an element into the queue. It will be done at the rear.&lt;br&gt;
dequeue → deleting an element from the queue. It will be done at the front.&lt;/p&gt;

&lt;p&gt;There are two conditions:&lt;br&gt;
overflow → insertion into a queue that is full&lt;br&gt;
underflow → deletion from the empty queue&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class my_queue:

    def __init__(self):
        self.data = []

    def length(self):
        return len(self.data)

    def enque(self, element): # put the element in the queue
        if len(self.data) &amp;lt; 5:
            return self.data.append(element)
        else:
            return "overflow"

    def deque(self): # remove the first element that we have put in queue
        if len(self.data) == 0:
             return "underflow"
        else:
            self.data.pop(0)

b = myqueue()
b.enque(2) # put the element into the queue
b.enque(3)
b.enque(4)
b.enque(5)
print(b.data)
b.deque()# # remove the first element that we have put in the queue
print(b.data)

#OUTOUT
'''
[2, 3, 4, 5]
[3, 4, 5]
'''
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;STACK&lt;/strong&gt;&lt;br&gt;
A stack is a linear data structure that stores items in a Last-In/First-Out (LIFO) or First-In/Last-Out (FILO) manner. &lt;br&gt;
In stack, a new element is added at one end and an element is removed from that end only. &lt;br&gt;
The insert and delete operations are often called push and pop.&lt;/p&gt;

&lt;p&gt;The operations of stack are:&lt;/p&gt;

&lt;p&gt;Push → inserting an element into the stack&lt;br&gt;
Pop → deleting an element from the stack&lt;/p&gt;

&lt;p&gt;The conditions to check:&lt;/p&gt;

&lt;p&gt;overflow condition → this condition occurs when we try to put one more element into a stack that is already having maximum elements.&lt;/p&gt;

&lt;p&gt;underflow condition →this condition occurs when we try to delete an element from an empty stack.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class my_stack:

    def __init__(self):
        self.data =[]

    def length(self): #length of the list
        return len(self.data)

    def is_full(self): #check if the list is full or not
        if len(self.data) == 5:
            return True
        else:
            return False

    def push(self, element):# insert a new element
        if len(self.data) &amp;lt; 5:
            self.data.append(element)
        else:
            return "overflow"

    def pop(self): # # remove the last element from a list
        if len(self.data) == 0:
            return "underflow"
        else:
            return self.data.pop()

a = mystack() # I create my object
a.push(10) # insert the  element
a.push(23)
a.push(25)
a.push(27)
a.push(11)
print(a.length())
print(a.is_full())
print(a.data)
print(a.push(31)) # we try to insert one more element in the list - the output will be overflow
print(a.pop())
print(a.pop())
print(a.pop())
print(a.pop())
print(a.pop())
print(a.pop()) # try to delete an element in a list without elements - the output will be underflow

#OUTPUT
#5
#True
#[10, 23, 25, 27, 11]
#overflow
#11
#27
#25
#23
#10
#underflow

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;LINKED LIST&lt;/strong&gt;&lt;br&gt;
A linked list is a sequence of data elements, which are connected together via links. &lt;br&gt;
Each data element contains a connection to another data element in form of a pointer. &lt;br&gt;
Python does not have linked lists in its standard library. We use the concept of nodes to implement linked lists&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Node:
   def __init__(self, dataval=None):
      self.dataval = dataval
      self.nextval = None

class SLinkedList:
   def __init__(self):
      self.headval = None

list1 = SLinkedList()
list1.headval = Node("Mon")
e2 = Node("Tue")
e3 = Node("Wed")
# Link first Node to second node
list1.headval.nextval = e2

# Link second Node to third node
e2.nextval = e3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>python</category>
      <category>programming</category>
    </item>
    <item>
      <title>Python 101: Introduction to Modern python.</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Mon, 14 Feb 2022 20:53:21 +0000</pubDate>
      <link>https://dev.to/joshwaoti/python-101-introduction-to-modern-python-1h7a</link>
      <guid>https://dev.to/joshwaoti/python-101-introduction-to-modern-python-1h7a</guid>
      <description>&lt;p&gt;Python is a high level, interpreted and object oriented scripting language. Python is designed to have readable syntax and is therefore more suitable for beginners who are learning how to code. It was developed by Guido van Rossum in the late eighties and early nineties at the National Research Institute for Mathematics and Computer Science in the Netherlands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features of python&lt;/strong&gt;&lt;br&gt;
Python's features include:&lt;/p&gt;

&lt;p&gt;-Easy to learn − Python has few keywords, simple structure, and a clearly defined syntax. This allows the student to pick up the language quickly. An example if I wanted to print a "hello world" program.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello world")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;-Easy to read − Python code is more clearly defined and visible to the eyes.&lt;/p&gt;

&lt;p&gt;-Easy to maintain − Python's source code is fairly easy-to-maintain.&lt;/p&gt;

&lt;p&gt;A broad standard library − Python's bulk of the library is very portable and cross-platform compatible on UNIX, Windows, and Macintosh.&lt;/p&gt;

&lt;p&gt;Interactive Mode − Python has support for an interactive mode which allows interactive testing and debugging of snippets of code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It supports functional and structured programming methods as well as OOP.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It can be used as a scripting language or can be compiled to byte-code for building large applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Uses of python&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Data analysis and machine learning&lt;br&gt;
Python has become a staple in data science, allowing data analysts and other professionals to use the language to conduct complex statistical calculations, create data visualizations, build machine learning algorithms, manipulate and analyze data, and complete other data-related tasks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Web development&lt;br&gt;
Python is often used to develop the back end of a website or application—the parts that a user doesn’t see. Python’s role in web development can include sending data to and from servers, processing data and communicating with databases, URL routing, and ensuring security. Python offers several frameworks for web development. Commonly used ones include Django and Flask.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automation or scripting&lt;br&gt;
If you find yourself performing a task over and over again, you could work more efficiently by automating it with Python. Writing code used to build these automated processes is called scripting. In the coding world, automation can be used to check for errors across multiple files, convert files, execute simple math, and remove duplicates in data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Game development&lt;br&gt;
Python is used to in designing and building games. For practices you can build games like snake game, blackjack, card game etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Everyday tasks&lt;br&gt;
Python isn't only for programmers and data scientists. Learning Python can open new possibilities for those in less data-heavy professions, like journalists, small business owners, or social media marketers. Python can also enable non-programmer to simplify certain tasks in their lives. Here are just a few of the tasks you could automate with Python:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keep track of stock market or crypto prices&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Send yourself a text reminder to carry an umbrella anytime it’s raining&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update your grocery shopping list&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Renaming large batches of files&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Converting text files to spreadsheets&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Randomly assign chores to family members&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill out online forms automatically&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Top websites to learn python&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Udemy&lt;br&gt;
It's another popular online course platform, which probably has the biggest collection of online courses on earth. I like Udemy because you can virtually find a course on anything you want to learn and that too for free. &lt;br&gt;
&lt;a href="https://www.udemy.com/course/pythonautomation/"&gt;https://www.udemy.com/course/pythonautomation/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Coursera&lt;br&gt;
If you want to learn from the world's leading universities without paying a single cent then Coursera is the place to go. It offers online courses taught at reputed universities like Stanford, INSEAD, NUS (National University of Singapore), and many more.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On top of that, it's has one of the most popular free courses to learn Python - Programming for Everybody (Getting Started with Python).&lt;/p&gt;

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