<?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: M__</title>
    <description>The latest articles on DEV Community by M__ (@idimaimuna).</description>
    <link>https://dev.to/idimaimuna</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%2F404495%2Ff9df7949-cd9b-4686-9c91-2d83bbc23680.jpg</url>
      <title>DEV Community: M__</title>
      <link>https://dev.to/idimaimuna</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/idimaimuna"/>
    <language>en</language>
    <item>
      <title>My Web Development Achievement.</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Wed, 10 Mar 2021 10:32:06 +0000</pubDate>
      <link>https://dev.to/idimaimuna/my-web-development-achievement-ja</link>
      <guid>https://dev.to/idimaimuna/my-web-development-achievement-ja</guid>
      <description>&lt;p&gt;Early this year, I made a decision that resulted in me having to get back to the drawing board and start over.&lt;br&gt;
I decided to look for a Bootcamp of sorts and follow through till the end and that's when I found &lt;a href="https://www.theodinproject.com/"&gt;The Odin Project&lt;/a&gt; Foundations course and decided to take the leap.&lt;/p&gt;

&lt;p&gt;For the first bit, I have learned some basics of Git and set up &lt;a href="https://github.com/Mwanaidi-M"&gt;my GitHub&lt;/a&gt; then started on HTML and CSS by following &lt;a href="https://www.freecodecamp.org"&gt;FreeCodeCamp's&lt;/a&gt; Responsive Web Design Curriculum and I'm happy to report that I completed it and got my certification.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/3NtY188QaxDdC/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3NtY188QaxDdC/giphy.gif" alt="happy-face"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While going through the curriculum, I got help from Google, Youtube, and some blogs and it feels good having seen something from start to finish.&lt;/p&gt;

&lt;p&gt;So I would like to share the link to &lt;a href="https://codepen.io/mwanaidi-m"&gt;my CodePen&lt;/a&gt; and would appreciate it if you could take a look at some of the projects I've done and give some feedback or remarks. It would be very helpful.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>codenewbie</category>
      <category>html</category>
      <category>css</category>
    </item>
    <item>
      <title>Nevertheless, M__ Coded in 2021!</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Tue, 09 Mar 2021 07:13:07 +0000</pubDate>
      <link>https://dev.to/idimaimuna/nevertheless-m-coded-in-2021-2pf1</link>
      <guid>https://dev.to/idimaimuna/nevertheless-m-coded-in-2021-2pf1</guid>
      <description>&lt;h2&gt;
  
  
  My most recent achievement was:
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Going back to the drawing board to relearn web development all over again because after being in a certain internship, I realized that I did not know as much as I thought and that I had a long way to go.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm currently going through &lt;a href="https://www.theodinproject.com/home"&gt;the Odin Project&lt;/a&gt; Foundations course and I'm happy that I'm able to grasp the concepts a bit better than I did before. That's progress.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Advocating for myself looks like:
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Being courageous enough to stand up for myself when I feel like I'm not being heard. It's very important to speak up regardless of the situation because it's worse to be silent especially when a matter affects you or others either on a personal level or not.&lt;/em&gt; &lt;/p&gt;

&lt;h4&gt;
  
  
  The truth will always win.
&lt;/h4&gt;

&lt;h2&gt;
  
  
  My biggest goal is:
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Become a notable developer regardless of my gender or race or religion and stand out by my work and ensure that whatever I do is of help to anyone and everyone. Sharing knowledge is part of growth.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Have mentors and be a mentor to anyone struggling with tech in one way or another.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  My advice for allies to support underrepresented folks who code is:
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Never downplay or undermine any questions a new developer asks. Be willing to help because how you guide them will affect how they learn and eventually how they assist developers who come after them.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Always check up on them because some of us(like me) are introverted and might be afraid or shy to ask questions because we might be told off. Checking up on us always makes us feel like yes, someone does care and wants to see me succeed as well.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Kindness goes a long way in helping someone.
&lt;/h2&gt;

</description>
      <category>wecoded</category>
    </item>
    <item>
      <title>List Comprehension</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Fri, 31 Jul 2020 11:51:53 +0000</pubDate>
      <link>https://dev.to/idimaimuna/list-comprehension-1c7k</link>
      <guid>https://dev.to/idimaimuna/list-comprehension-1c7k</guid>
      <description>&lt;p&gt;Hi there, I am back with another python concept; &lt;strong&gt;list comprehension&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A list is a collection of related data e.g. a collection of my favorite movies or books. Lists in python can contain numbers, strings, lists etc. In python you can create lists like so:&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;my_movies&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'Gone Girl’, ‘The Current War’, ‘Crazy Rich Asians'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;#if you are creating a list of a number of elements from input given
&lt;/span&gt;&lt;span class="n"&gt;my_movies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="c1"&gt;#declare an empty list
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&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="c1"&gt;#loop through 3 elements
&lt;/span&gt;    &lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;#accept input from the user
&lt;/span&gt;    &lt;span class="n"&gt;my_movies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;#add that input to your list
&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_movies&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;#display your complete list
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;strong&gt;list comprehension&lt;/strong&gt; is a simple way of creating lists in one line instead of writing many lines of code. One thing I noticed is when using list comprehensions most of the time ranges are involved:&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="c1"&gt;#loops through numbers starting from 1 and stopping at 11(not inclusive)
&lt;/span&gt;&lt;span class="n"&gt;first_ten_numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&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;11&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;first_ten_numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="s"&gt;'''
Output:
[1,2,3,4,5,6,7,8,9,10]
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One can also use ‘if- statements’ in list comprehensions to check a certain condition:&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="c1"&gt;#loops through numbers starting from 1 and stopping at 11(not inclusive) and display only even numbers
&lt;/span&gt;&lt;span class="n"&gt;first_ten_even_numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&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;11&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;n&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&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;first_ten_even_numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="s"&gt;'''
Output:
[2,4,6,8,10]
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is also possible to make nested lists:&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="c1"&gt;#loops through numbers starting from 1 and stopping at 4(not inclusive) 
&lt;/span&gt;&lt;span class="n"&gt;multi_list&lt;/span&gt; &lt;span class="o"&gt;=&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="n"&gt;y&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="nb"&gt;range&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;4&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;y&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&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;4&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;multi_list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="s"&gt;'''
Output:
[[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]] 
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List comprehensions can be very helpful when you need to create simple lists and it saves you a couple lines of code so it’s worth noting.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Have you made such an Application</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Sat, 18 Jul 2020 09:40:35 +0000</pubDate>
      <link>https://dev.to/idimaimuna/have-you-made-such-an-application-1318</link>
      <guid>https://dev.to/idimaimuna/have-you-made-such-an-application-1318</guid>
      <description>&lt;p&gt;Hello there, I hope you're doing well and are keeping safe.&lt;/p&gt;

&lt;p&gt;I'm doing okay as well just occupied with trying to keep on self learning and my internship and I'm back with another question PHP related.&lt;/p&gt;

&lt;p&gt;Has any of you ever made a message board kind of application: you have three columns, first column has a list of messages received from different platforms, second column has the area where you can chat with your client then the third column has profile information of the client you're talking to.&lt;/p&gt;

&lt;p&gt;It's like a crm software but one you made yourself that fully works and can display messages from different platforms like Facebook, Twitter, gmail and such?&lt;/p&gt;

</description>
      <category>php</category>
      <category>programming</category>
    </item>
    <item>
      <title>PHP MVC</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Sat, 11 Jul 2020 17:27:34 +0000</pubDate>
      <link>https://dev.to/idimaimuna/php-mvc-3kbf</link>
      <guid>https://dev.to/idimaimuna/php-mvc-3kbf</guid>
      <description>&lt;p&gt;So I got an internship somewhere and assigned a project that uses php...my knowledge of PHP is very basic to be honest and one of the specifications for implementing the project is using MVC.&lt;/p&gt;

&lt;p&gt;I am familiar with the concept but I have tried researching and writing some code for the login and registration but every time I want to connect it to a database, a sea of errors is what I get.&lt;/p&gt;

&lt;p&gt;I have tried looking for content online that can clearly explain the concept with easily understandable code but nothing so far.&lt;br&gt;
Such are the struggles of a programmer...😞&lt;/p&gt;

</description>
      <category>php</category>
      <category>help</category>
    </item>
    <item>
      <title>DAY 17: MORE EXCEPTIONS</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Wed, 08 Jul 2020 15:23:07 +0000</pubDate>
      <link>https://dev.to/idimaimuna/day-17-more-exceptions-2i92</link>
      <guid>https://dev.to/idimaimuna/day-17-more-exceptions-2i92</guid>
      <description>&lt;p&gt;It's been a while since I posted anything about my progress and I will give my explanation right after explaining what I understood from this challenge.&lt;/p&gt;

&lt;p&gt;The challenge was about raising an Exception.Raising an exception is when one forces an exception to occur, it’s identified by the keyword &lt;strong&gt;raise&lt;/strong&gt; followed by an exception instance or exception class then add a message to be displayed when the exception occurs. E.g.&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;raise&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'I forced this.'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The Task:&lt;/strong&gt;&lt;br&gt;
Write a &lt;strong&gt;Calculator&lt;/strong&gt; class with a single method: &lt;strong&gt;int power(int,int)&lt;/strong&gt;. The power method takes two integers, &lt;strong&gt;n&lt;/strong&gt; and &lt;strong&gt;p&lt;/strong&gt;, as parameters and returns the integer result of &lt;strong&gt;n^p&lt;/strong&gt;. If either &lt;strong&gt;n&lt;/strong&gt; or &lt;strong&gt;p&lt;/strong&gt; is negative, then the method must throw an exception with the message: &lt;strong&gt;n and p should be non-negative.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Calculator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;power&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c1"&gt;#check if either n or p is negative
&lt;/span&gt;        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="c1"&gt;#raising the exception if either of the values is negative
&lt;/span&gt;            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'n and p should be non-negative'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="c1"&gt;# returning the value of n to the power of p
&lt;/span&gt;            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;


&lt;span class="n"&gt;cl1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Calculator&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;#number of test cases to be input
#looping though every test case
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;#create two variables as the input is space-separated
&lt;/span&gt;    &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;ans&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cl1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;power&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;p&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;ans&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&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;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="s"&gt;'''
Sample Input

4
3 5
2 4
-1 -2
-1 3
Sample Output

243
16
n and p should be non-negative
n and p should be non-negative
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I learnt a new concept by this and I look forward to implementing it in my code.&lt;/p&gt;

&lt;p&gt;Aside from this, I have to admit that currently I should be in Day 28 of the challenge but I have struggled with some of the questions, some I know bits others I have no clue so this will be my last challenge to post because I have no clear understanding of the others. &lt;/p&gt;

&lt;p&gt;I am still learning them but recently I got a work opportunity which takes most of my time now and uses a different programming language so that means i have to get familiar with that language as well. I'm well aware that learning two or more languages consecutively will be a challenge but I will try to practice even if it's 15 minutes for some days. I will post every bit of new information I learn.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>DAY 17: MORE EXCEPTIONS</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Sat, 27 Jun 2020 07:50:17 +0000</pubDate>
      <link>https://dev.to/idimaimuna/day-17-more-exceptions-4b3o</link>
      <guid>https://dev.to/idimaimuna/day-17-more-exceptions-4b3o</guid>
      <description>&lt;p&gt;Yesterday’s challenge was about exceptions and today was a continuation on that topic but on a different aspect; raising an Exception.&lt;/p&gt;

&lt;p&gt;Raising an exception is when one forces an exception to occur, it’s identified by the keyword &lt;strong&gt;raise&lt;/strong&gt; followed by an exception instance or exception class then add a message to be displayed when the exception occurs. E.g. &lt;strong&gt;raise Exception(‘my message here’)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Task:&lt;/strong&gt;&lt;br&gt;
Write a Calculator class with a single method: int &lt;strong&gt;power(int,int)&lt;/strong&gt;. The power method takes two integers, &lt;strong&gt;n&lt;/strong&gt; and &lt;strong&gt;p&lt;/strong&gt;, as parameters and returns the integer result of &lt;strong&gt;n^p&lt;/strong&gt;. If either &lt;strong&gt;n&lt;/strong&gt; or &lt;strong&gt;p&lt;/strong&gt; is negative, then the method must throw an exception with the message: &lt;strong&gt;n and p should be non-negative.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Calculator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;power&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c1"&gt;#check if either n or p is negative
&lt;/span&gt;        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="c1"&gt;#raising the exception if either of the values is negative
&lt;/span&gt;            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'n and p should be non-negative'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="c1"&gt;# returning the value of n to the power of p
&lt;/span&gt;            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;


&lt;span class="n"&gt;cl1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Calculator&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;#number of test cases to be input
#looping though every test case
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;#create two variables as the input is space-separated
&lt;/span&gt;    &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;ans&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cl1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;power&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;p&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;ans&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&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;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="s"&gt;'''
Sample Input

4
3 5
2 4
-1 -2
-1 3
Sample Output

243
16
n and p should be non-negative
n and p should be non-negative
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>python</category>
    </item>
    <item>
      <title>DAY 14:Exceptions</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Fri, 26 Jun 2020 12:28:34 +0000</pubDate>
      <link>https://dev.to/idimaimuna/day-14-exceptions-41no</link>
      <guid>https://dev.to/idimaimuna/day-14-exceptions-41no</guid>
      <description>&lt;p&gt;An Exception is an error that occurs whenever there is something wrong with the code one writes or if there’s something wrong with the system one is working on. Usually we can identify an exception when a program crashes (stops working horribly, no programmer likes to see that) and in order to avoid that, we can write our program inside a &lt;strong&gt;try-except&lt;/strong&gt; block. &lt;/p&gt;

&lt;p&gt;This means that we are preparing our program to handle any error that may occur so instead of a horrible crash, you will get a simple message letting you know what happened. &lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;try&lt;/strong&gt;-block is where you write the code that may cause an exception while the &lt;strong&gt;except&lt;/strong&gt;-block is where we write the exception handling logic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Task:&lt;/strong&gt;&lt;br&gt;
Read a string, &lt;em&gt;S&lt;/em&gt;, and print its integer value; if &lt;em&gt;S&lt;/em&gt; cannot be converted to an integer, print &lt;strong&gt;Bad String&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;S&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;int_s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;S&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;int_s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;except&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;'Bad String'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="s"&gt;'''
Sample Input 0

3
Sample Output 0

3
Sample Input 1

za
Sample Output 1

Bad String
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>python</category>
    </item>
    <item>
      <title>DAY 13: Abstract Classes</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Fri, 26 Jun 2020 12:24:12 +0000</pubDate>
      <link>https://dev.to/idimaimuna/day-13-abstract-classes-110j</link>
      <guid>https://dev.to/idimaimuna/day-13-abstract-classes-110j</guid>
      <description>&lt;p&gt;The challenge was a continuation of classes just that it was dealing with abstract classes. &lt;strong&gt;Abstract classes&lt;/strong&gt; are classes that have functions which have no body in them in simple terms, the functions are declared in that class but its functionality is not defined there and for the function to be executed, the derived class has to define its functionality. &lt;/p&gt;

&lt;p&gt;Python uses the &lt;strong&gt;ABCMeta&lt;/strong&gt; class for defining abstract base classes and it has a decorator, &lt;strong&gt;@abstractmethod&lt;/strong&gt; to indicate when there is an abstract method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Task:&lt;/strong&gt;&lt;br&gt;
Given a &lt;em&gt;Book&lt;/em&gt; class and a Solution class, write a &lt;em&gt;MyBook&lt;/em&gt; class that does the following:&lt;br&gt;
• Inherits from &lt;em&gt;Book&lt;/em&gt;&lt;br&gt;
• Has a parameterized constructor taking these  parameters:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; string &lt;strong&gt;title&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt; string &lt;strong&gt;author&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt; int &lt;strong&gt;price&lt;/strong&gt;
• Implements the &lt;em&gt;Book*class' abstract **display()&lt;/em&gt;* method so it prints these  lines:&lt;/li&gt;
&lt;li&gt; Title: , a space, and then the current instance's &lt;strong&gt;title&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt; Author: , a space, and then the current instance's &lt;strong&gt;author&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt; Price:, a space, and then the current instance's &lt;strong&gt;price&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ol&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;abc&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ABCMeta&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;abstractmethod&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;object&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;metaclass&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;ABCMeta&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt;   
    &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;abstractmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;display&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="k"&gt;pass&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyBook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Book&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;display&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&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="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;'Title: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;'&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="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;'Author: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;'&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="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;'Price: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="si"&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;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="n"&gt;new_novel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;MyBook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;new_novel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;display&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="s"&gt;'''
Sample Input:
The Alchemist
Paulo Coelho
248

Sample Output:
Title: The Alchemist
Author: Paulo Coelho
Price: 248
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>DAY 12: Inheritance</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Fri, 26 Jun 2020 12:19:21 +0000</pubDate>
      <link>https://dev.to/idimaimuna/day-12-inheritance-64j</link>
      <guid>https://dev.to/idimaimuna/day-12-inheritance-64j</guid>
      <description>&lt;p&gt;I’ve been MIA for a while because of I had some other things to take care of also going through the challenge I have met some concepts that have given me a tough time so I put them on hold for further research and keep going with the concepts I can grasp without so much hustle.&lt;/p&gt;

&lt;p&gt;This challenge was focusing on inheritance of classes whereby a &lt;strong&gt;child class(derived)&lt;/strong&gt; can get the properties and functions of the &lt;strong&gt;parent class(base)&lt;/strong&gt;. I learnt a number of new concepts while doing this challenge and as always, practice is key so that when it comes to tackling such questions or teaching the concept, things flow well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Task:&lt;/strong&gt;&lt;br&gt;
You are given two classes, &lt;em&gt;Person&lt;/em&gt; and &lt;em&gt;Student&lt;/em&gt;, where &lt;em&gt;Person&lt;/em&gt; is the base class and &lt;em&gt;Student&lt;/em&gt; is the derived class. Completed code for Person and a declaration for Student are provided for you in the editor. Observe that Student inherits all the properties of Person.&lt;/p&gt;

&lt;p&gt;Complete the &lt;em&gt;Student&lt;/em&gt; class by writing the following:&lt;br&gt;
A &lt;em&gt;Student&lt;/em&gt; class constructor, which has  parameters:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; A string, &lt;em&gt;firstName&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt; A string, &lt;em&gt;lastName&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt; An integer, &lt;em&gt;id&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt; An integer array (or vector) of test scores, &lt;em&gt;scores&lt;/em&gt;.
A char &lt;em&gt;calculate()&lt;/em&gt; method that calculates a Student object's average and returns the grade character representative of their calculated average:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;idNumber&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;firstName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;firstName&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lastName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;lastName&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;idNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;idNumber&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;printPerson&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&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;'Name:'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lastName&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="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;firstName&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;'ID:'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;idNumber&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;idNumber&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;firstName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;firstName&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lastName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;lastName&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;idNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;idNumber&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;scores&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;calculate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;numScores&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt;&lt;span class="mi"&gt;90&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&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;return&lt;/span&gt; &lt;span class="s"&gt;'O'&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;'E'&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;'A'&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;55&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;'P'&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt;  &lt;span class="mi"&gt;40&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;'D'&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ave&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;'T'&lt;/span&gt;

&lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;firstName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;lastName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;line&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="n"&gt;idNum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;line&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="n"&gt;numScores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;idNum&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;printPerson&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;"Grade:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;calculate&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="s"&gt;'''
Sample Input

Heraldo Memelli 8135627
2
100 80

Sample Output
Name: Memelli, Heraldo
ID: 8135627
Grade: O
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>DAY 10: BINARY NUMBERS</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Sat, 20 Jun 2020 09:33:47 +0000</pubDate>
      <link>https://dev.to/idimaimuna/day-10-binary-numbers-jmg</link>
      <guid>https://dev.to/idimaimuna/day-10-binary-numbers-jmg</guid>
      <description>&lt;p&gt;Binary numbers represent a value in form of 1’s and 0’s. Python has a &lt;strong&gt;bin()&lt;/strong&gt; method for converting integers to their binary format which makes the execution easy. However, the hard part comes when you have to get the number of consecutive 1’s in the binary value.&lt;/p&gt;

&lt;p&gt;Such questions that ask to find the number of consecutive values in a sequence have been quite tough for me so anyone with tips on how to make such questions simpler to understand and work out, I would really appreciate the help.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Task:&lt;/strong&gt;&lt;br&gt;
Given a base-10 integer, n, convert it to binary (base-2). Then find and print the base- 10 integer denoting the maximum number of consecutive 1's in n's binary representation.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>DAY 9: RECURSION</title>
      <dc:creator>M__</dc:creator>
      <pubDate>Fri, 19 Jun 2020 12:40:08 +0000</pubDate>
      <link>https://dev.to/idimaimuna/day-9-recursion-72o</link>
      <guid>https://dev.to/idimaimuna/day-9-recursion-72o</guid>
      <description>&lt;p&gt;When I was learning programming in school I never understood what recursion was and kept getting confused. I thought I would never have to write such code again and you can imagine my surprise when I saw this challenge.&lt;/p&gt;

&lt;p&gt;Luckily, I did some research on it yesterday and looking at the explanation and code in Python it was quite simple to grasp as it was clear plus I read it like three times to get the gist of it.&lt;/p&gt;

&lt;p&gt;Basically a recursive function is a function that calls itself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Task:&lt;/strong&gt;&lt;br&gt;
Write a factorial function that takes a positive integer, N as a parameter and prints the result N! of (N factorial).&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="c1"&gt;# defining my function that accepts an integer.
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# if the integer is 1 then the function returns the value 1
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt;
    &lt;span class="c1"&gt;#if the intege ris not 1 then it calculates the factorial by calling the same function we created subtracting 1 from the integer.
&lt;/span&gt;    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="s"&gt;'''
Sample Input

3

Sample Output

6
'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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