<?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: Henrique Lopes</title>
    <description>The latest articles on DEV Community by Henrique Lopes (@riquellopes).</description>
    <link>https://dev.to/riquellopes</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%2F135801%2Faa7db76f-91bd-4bd2-a1a4-d27bc01fe57b.jpeg</url>
      <title>DEV Community: Henrique Lopes</title>
      <link>https://dev.to/riquellopes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/riquellopes"/>
    <language>en</language>
    <item>
      <title>How do I improve my python skills</title>
      <dc:creator>Henrique Lopes</dc:creator>
      <pubDate>Mon, 11 Feb 2019 21:54:26 +0000</pubDate>
      <link>https://dev.to/riquellopes/how-do-i-improve-my-python-skills-23jp</link>
      <guid>https://dev.to/riquellopes/how-do-i-improve-my-python-skills-23jp</guid>
      <description>&lt;p&gt;I'll give you a simple tip about improving your python skills. It’s very simple and of the bonus is that many technology companies apply your challenges over there. I'm speaking about Hackerrank which is a famous platform where you can practice coding and find jobs . I usually take up one coding challenge per week, I like math problems and Python.&lt;/p&gt;

&lt;p&gt;You can find range of problems over there, it starts from basic to the most difficult ones, at every step you get a different level problem . I use this tool to think better and to practise. My profile contact is contato44. I'll share a simple problem that you can to see on Hackerrank:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="s"&gt;"""
    &amp;gt;&amp;gt;&amp;gt; count_substring("ABCDCDC", "CDC")
    2
    &amp;gt;&amp;gt;&amp;gt; count_substring("ABCDCDCAAAACDC", "CDC")
    3
    &amp;gt;&amp;gt;&amp;gt; count_substring("ThIsisCoNfUsInG", "is")
    1
"""&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;count_substring&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sub_string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;occurrences&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;__&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;cut&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sub_string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;i&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;cut&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;sub_string&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;occurrences&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;occurrences&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To solve the problem I'm using the &lt;a href="https://docs.python.org/2/library/doctest.html"&gt;Doctest&lt;/a&gt;, because is it simple and fast to write the test. I submit the solution with &lt;a href="https://docs.python.org/2/library/doctest.html"&gt;Doctest&lt;/a&gt;. You can execute the &lt;a href="https://docs.python.org/2/library/doctest.html"&gt;Doctest&lt;/a&gt; of 2 modes in your machine:&lt;/p&gt;

&lt;h4&gt;
  
  
  First mode:
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;PS: After to execute the code, add the snippet in final code.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
   &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;doctest&lt;/span&gt;
   &lt;span class="n"&gt;doctest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;testmod&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Run the test feature.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;python Findastring.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Seconde mode:
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;ps: When I use the Doctest to run my test feature, this what I do.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; doctest Findastring.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Today I share a simple tip on improving your developer skill, If have another tip, kindly let me know.&lt;/p&gt;

&lt;p&gt;Originally post on:&lt;br&gt;
&lt;a href="https://medium.com/@riquellopes/how-do-i-improve-my-python-skills-89075f2e22e2"&gt;https://medium.com/@riquellopes/how-do-i-improve-my-python-skills-89075f2e22e2&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>programing</category>
      <category>math</category>
      <category>hackerrank</category>
    </item>
  </channel>
</rss>
