<?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: Saurabh Sharma</title>
    <description>The latest articles on DEV Community by Saurabh Sharma (@devsaurabh).</description>
    <link>https://dev.to/devsaurabh</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%2F72914%2F62e451d1-2483-48b9-81da-808c40ba5ce9.jpg</url>
      <title>DEV Community: Saurabh Sharma</title>
      <link>https://dev.to/devsaurabh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devsaurabh"/>
    <language>en</language>
    <item>
      <title>Attributes in HTML - Web Development for Toddlers</title>
      <dc:creator>Saurabh Sharma</dc:creator>
      <pubDate>Wed, 23 Mar 2022 06:57:13 +0000</pubDate>
      <link>https://dev.to/devsaurabh/attributes-in-html-web-development-for-toddlers-21ei</link>
      <guid>https://dev.to/devsaurabh/attributes-in-html-web-development-for-toddlers-21ei</guid>
      <description>&lt;p&gt;Last we talked about HTML elements and their syntax!&lt;br&gt;
We came across an odd looking piece of code, that went like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://picsum.photos/200/300"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The syntax for an attribute goes like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;tag-name&lt;/span&gt; &lt;span class="na"&gt;attribute-name=&lt;/span&gt;&lt;span class="s"&gt;"attribute-value"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/tag-name&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if you compare the syntax with that image example, we find an attribute, with attribute-name "src", and attribute-value as an URL to the image that's stored on the internet.&lt;/p&gt;

&lt;h3&gt;
  
  
  There can be multiple attributes associated with an element
&lt;/h3&gt;

&lt;p&gt;Tons of them actually, and that's pretty common to see.&lt;br&gt;
So how do you go about making that happen?&lt;br&gt;
Here's a syntax breakdown&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;tag-name&lt;/span&gt; &lt;span class="na"&gt;attribute-name1=&lt;/span&gt;&lt;span class="s"&gt;"attribute-value1"&lt;/span&gt; &lt;span class="na"&gt;attribute-name2=&lt;/span&gt;&lt;span class="s"&gt;"attribute-value2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/tag-name&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A real life example would look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"userPassword"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"standard-input"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if none of these make sense, don't worry, we'll get there.&lt;br&gt;
But you get my point, don't you?&lt;/p&gt;

&lt;p&gt;From a surface level classification, we can categorise attributes on two sets of bases&lt;/p&gt;
&lt;h2&gt;
  
  
  Attributes which have some value
&lt;/h2&gt;

&lt;p&gt;Like the ones we saw, there are some attributes that might contain some data, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"btn btn-primary"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
 Click Me!
&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now what does this class attribute do? We'll discuss that in the next chapter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Attributes which don't have any value
&lt;/h2&gt;

&lt;p&gt;There are some attributes that don't need any value, for example this bit of code with make the render the button as unclickable (try running it in &lt;a href="https://jsbin.com/?html,output"&gt;JSBin&lt;/a&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;disabled&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
 You can't click me
&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Now the second way we can categorize attributes would be&lt;/p&gt;

&lt;h2&gt;
  
  
  Common attributes
&lt;/h2&gt;

&lt;p&gt;These attributes can be applied on pretty much every element there is, some of them might be: "id", "class", "name" etc.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"btn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Click Me&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;hr&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"make-me-red"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"is-should-be-a-box"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
I am not a box yet, we'll need to learn CSS to do so!
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Although those class attributes and their values seems to do nothing in this example, we'll get to them when we start CSS in a few chapters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Element specific attributes
&lt;/h2&gt;

&lt;p&gt;There are some attributes which if applied with a combination of possible values, will direct the browser to function a bit differently.&lt;br&gt;
For example the "type" attribute for "input" elements.&lt;br&gt;
Run this code in the browser and see for yourself!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"This is a text input"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"This is a password input"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try writing something in those inputs which just popped up! Did you see that?&lt;br&gt;
The second input (password one) hides whatever you type, that's because we instructed the browser to do so (with the attribute type).&lt;br&gt;
Also the attribute "placeholder" is "input" element specific. That means if you try to use this attribute on any other element, the browser wouldn't know what to do with it and won't make any difference.&lt;/p&gt;

&lt;p&gt;Consider this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Some value that makes no difference"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    See! "placeholder" is uselss here
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Custom Attributes
&lt;/h2&gt;

&lt;p&gt;The standards says if we ever want to store some of our values in the form of an attribute with an element, we do so with attributes prepended with "data-". &lt;br&gt;
Now this won't make any difference, but it just helps us differentiate between native attributes (or the common + element specific ones) vs custom ones (the ones we create).&lt;/p&gt;

&lt;p&gt;Now for example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;custom-attribute=&lt;/span&gt;&lt;span class="s"&gt;"custom-value"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;data-custom-attribute=&lt;/span&gt;&lt;span class="s"&gt;"custom-value"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both of these are acceptable! But let's follow the standards (remember that animal analogy!).&lt;/p&gt;

&lt;p&gt;That being said, why would we use custom attributes or to be more precise any attribute at all that does nothing in the browser output!?&lt;/p&gt;

&lt;p&gt;Well, that's because element specific attributes only work because the browser's render engine is programmed to do something with it. Similarly we can use JavaScript to make use of these custom attributes or any attribute we'd like to do something that we want.&lt;br&gt;
And we'll do so! in a couple of chapters, after a bit of CSS.&lt;/p&gt;

</description>
      <category>html</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Elements in HTML - Web Development for Toddlers</title>
      <dc:creator>Saurabh Sharma</dc:creator>
      <pubDate>Mon, 14 Mar 2022 11:34:56 +0000</pubDate>
      <link>https://dev.to/devsaurabh/web-development-for-toddlers-3-elements-in-html-2ln2</link>
      <guid>https://dev.to/devsaurabh/web-development-for-toddlers-3-elements-in-html-2ln2</guid>
      <description>&lt;p&gt;As I talked about elements briefly in the last part of this series, they are the building blocks of what an HTML document is.&lt;/p&gt;

&lt;p&gt;Though not a programming language (since there's no logic that you can implement with it, just an output layer), HTML still is a high level language.&lt;/p&gt;

&lt;p&gt;What does that mean?&lt;/p&gt;

&lt;p&gt;Simply put, the people behind it made sure to give us a lot of options to make sure we wouldn't struggle while working with it.&lt;/p&gt;

&lt;p&gt;And elements are those ready-made stuff available for us to use however we'd like.&lt;br&gt;
The combinations are endless (every website you've ever visited uses the same set of HTML elements to build it!)&lt;/p&gt;

&lt;p&gt;Broadly speaking, elements can be divided in two types.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Elements that can bear children
&lt;/h3&gt;

&lt;p&gt;We've seen them before! &lt;br&gt;
Just to jog your memory a bit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    Hello World!
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do you see it yet? &lt;br&gt;
We have two elements in this piece of code above. An "html" element and one "body" element.&lt;br&gt;
They both seem to have a start tag that looks like &lt;code&gt;&amp;lt;element-name&amp;gt;&lt;/code&gt; and ends with &lt;code&gt;&amp;lt;/element-name&amp;gt;&lt;/code&gt;.&lt;br&gt;
And whatever resides inside or between those tags is called it's content of child or children (if there are more than one of them).&lt;/p&gt;

&lt;p&gt;To explain it further, the element body is a child element of "html" element.&lt;br&gt;
The text "Hello World!" is not an element, but it's still a child of "body" element!&lt;br&gt;
So what is it if it's not an element?&lt;br&gt;
It's that element's content! or to be more precise, it's a text node.&lt;/p&gt;

&lt;p&gt;Wait ... what's a node?&lt;br&gt;
Aaah, let's get back to compare it with some real life example.&lt;br&gt;
In english we call them figure of speech right? And this example would be a "Simile" (correct me if I'm wrong).&lt;/p&gt;

&lt;p&gt;The entire HTML element can be considered a tree (a real life tree, like a big one).&lt;br&gt;
Everything in that tree can be considered a "node".&lt;br&gt;
So whether it's leaves, the trunk (the huge body of the tree) or the branches, they're all nodes.&lt;/p&gt;

&lt;p&gt;So ... an element is necessarily a node as well!&lt;br&gt;
WAIT! What?&lt;br&gt;
Yes, an element is a node. And the content that we write inside it could be another node (whether an element node or a text node).&lt;/p&gt;

&lt;p&gt;So coming back to the example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    Hello World!
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We start with an element node that's "html". It has a start and end tag.&lt;br&gt;
It "contains" content. Content is whatever is inside those starting and ending tags.&lt;br&gt;
And in this case, it's an element node "body".&lt;br&gt;
Now comes the tricky part you see.&lt;br&gt;
Body does have some content and it's a text node!&lt;/p&gt;

&lt;p&gt;Did I explain that right?&lt;/p&gt;

&lt;p&gt;Now the people who made HTML made tons of different kinds of elements for us to combine in whatever way we'd like.&lt;br&gt;
And to be honest, most of them are replacable with each other. So why create so many of them?&lt;br&gt;
To put it simply, it's for the sake of structuring our code to make it more readable.&lt;br&gt;
To explain it better, consider an entire page of a newspaper in same font size, same color, nothing's bold, everything looks the same.&lt;br&gt;
It'd work right? I mean you can still read it and get to know the news but it'd just confuse you.&lt;br&gt;
You wouldn't be able to find when a paragraph ends, and a title begins easily.&lt;/p&gt;

&lt;p&gt;And for that purpose, they made lots of these elements. &lt;br&gt;
So let's see a few of these elements.&lt;/p&gt;

&lt;p&gt;Open up &lt;a href="https://jsbin.com/?html,output"&gt;JSBin&lt;/a&gt;, this online tool helps us write HTML code in the left panel and see the output on the right.&lt;br&gt;
You may delete whatever's already there on the left, we'll write everything ourselves.&lt;/p&gt;

&lt;p&gt;Let's start with this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;
      This is very big heading
    &lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;
      Not as big
    &lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;h3&amp;gt;&lt;/span&gt;
      This looks small
    &lt;span class="nt"&gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;h4&amp;gt;&lt;/span&gt;
      This looks smaller
    &lt;span class="nt"&gt;&amp;lt;/h4&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;h5&amp;gt;&lt;/span&gt;
      This looks even smaller
    &lt;span class="nt"&gt;&amp;lt;/h5&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;h6&amp;gt;&lt;/span&gt;
      This is unreadable
    &lt;span class="nt"&gt;&amp;lt;/h6&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What are these elements?&lt;br&gt;
These are what we call heading elements.&lt;br&gt;
There are 6 of them that we can use. And as you might have noticed, "h1" has the largest text size while "h6" the least.&lt;/p&gt;

&lt;p&gt;Now, spoiler alert!&lt;br&gt;
You could make each and any of these heading elements to look like the other one or way different that they already look and that's all possible with CSS! That we'll soon get to.&lt;br&gt;
But for now just understand that the HTML renderer (browser in this case) sometimes associates some basic styling with different kind of elements (like here it did, different font sizes for all 6 heading elements).&lt;/p&gt;

&lt;p&gt;Take a look at this code now.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
      Take a look at this
    &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
      This looks exactly the same as above right?
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's no visible font size difference here right!&lt;br&gt;
Also what does "p" and "div" even mean?&lt;/p&gt;

&lt;p&gt;"p" stands for a paragraph element while "div" for a division (there is one that's pretty similar to div, that's "section").&lt;/p&gt;

&lt;p&gt;But why have two elements that look exactly the same?&lt;br&gt;
Shouldn't we just use "p" to show some text?&lt;br&gt;
Yes. We should. And if it's all so confusing right now, just know that we'll get there!&lt;/p&gt;

&lt;p&gt;But there are two reasons as to why use multiple kinds of elements.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It helps with SEO. That's search engines.&lt;/li&gt;
&lt;li&gt;It helps you structure your code better. "p" should contain text while "div" should be more like a wrapper or container that might contain other elements, for example tons of paragraphs!?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;But what if what I'm trying to write is not a paragraph?&lt;br&gt;
What if it's just a name that I'd like to show, technically in english it's not a paragraph right?&lt;br&gt;
Should I still use the "p" element?&lt;br&gt;
I mean you can, but then you should instead use a "div" element.&lt;br&gt;
Take a look at this code below (write it out in the JSBin tool and see the output as well)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;
      About me
    &lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
      Saurabh Sharma
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
      Saurabh Sharma writes code, makes applications, is struggling to learn piano and guitar. Also he likes to watch movies day and night.
    &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, would it hurt if you used "p" instead of "div" or vice-versa?&lt;br&gt;
No! But it just helps you organize your code in a better way!&lt;/p&gt;

&lt;p&gt;Okay, okay, enough about it. We'll dive further some other time. Next.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Void elements, that can't have anything inside them
&lt;/h3&gt;

&lt;p&gt;Unlike "h1", "p" or "body", these elements aren't supposed to have any child node (whether another element node or a text node).&lt;/p&gt;

&lt;p&gt;For example, to show an image, HTML has a dedicated element that's called "img".&lt;br&gt;
The syntaxt (the way it should be written) looks like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"url-of-the-image"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🤯 It hurts my brain! What is that? (You probably, or probably not, I don't know).&lt;/p&gt;

&lt;p&gt;But this looks nothing alike the other elements we saw!&lt;br&gt;
So let's go through that line of code bit by bit! (not actual computer bits :p)&lt;/p&gt;

&lt;p&gt;We can see that the element does have a start tag but no end tag (that's the whole point of calling it a void or empty element).&lt;br&gt;
But that start tag looks a bit off!&lt;br&gt;
That's because unlike &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; it's &lt;code&gt;&amp;lt;img/&amp;gt;&lt;/code&gt;.&lt;br&gt;
But does it make any difference? Visually no, they'd both render the same thing (browsers are smart enough to recognize these void elements). Some might even not prefer to use that forward slash but I do! And since this is my guide, I'll ask you to use them as well! &lt;/p&gt;

&lt;p&gt;Okay, next. What's that &lt;code&gt;src="url-of-the-image"&lt;/code&gt; bit?&lt;br&gt;
That's called an attribute! And we'll discuss and deep very dive into them in the next part of this series but for now just assume that you know what those are (fake it till you make it, right?).&lt;/p&gt;

&lt;p&gt;There's this website &lt;a href="https://picsum.photos/"&gt;picsum.photos&lt;/a&gt; that lets us use random images however we'd like. So in your JSBin code editor, put this in the left panel&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://picsum.photos/200/200"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're wondering why didn't we use the entire&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://picsum.photos/200/200"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Well for two reasons, one, it's tiresome for me and second, since we don't really have a lot of code, it works the same.&lt;/p&gt;

&lt;p&gt;Let's see the output! You should be seeing an image! Awesome!&lt;/p&gt;

&lt;p&gt;But I wonder what would happen if I add an end tag to "img" element and put some content inside of it.&lt;br&gt;
Okay, to feed your curiosity&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://picsum.photos/200/200"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  Is this text visible?
&lt;span class="nt"&gt;&amp;lt;/img&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R0UGcc-5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pkrroouxeskq43qmnxfk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R0UGcc-5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pkrroouxeskq43qmnxfk.png" alt="An example of wrong img syntax" width="880" height="246"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you see a different image that mine, that's alright, that's the whole purpose of this picsum.photos server. It provides a random picture each time you request for one.&lt;/p&gt;

&lt;p&gt;Now back to the point. It did show the text node inside the "img" element. But it wasn't how it was supposed to go!&lt;/p&gt;

&lt;p&gt;And for that I have two explanations:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;HTML is pretty loose about it's rules (it's not strict) and let's you make mistakes and the renderer or browser tries to do the best it can with whatever input you have given it.&lt;/li&gt;
&lt;li&gt;Computers are dumb. So make sure to tell it precisely what you want it to do! &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It worked right!? &lt;br&gt;
An element that was supposed to be a void or empty element, that wasn't supposed to have any content or ending tag works the same way a container element would.&lt;br&gt;
And you're right, but that does not mean that you should do it.&lt;br&gt;
There are rules that we should follow, a structure we should maintain. I mean rules are what makes us different from animals right? You could go hunt a deer and eat it bare handed but should you do it?&lt;br&gt;
Absolutely no. Don't do it. &lt;/p&gt;

&lt;p&gt;And that's the same here. Void elements can work the same as a container element but you should avoid doing that.&lt;/p&gt;

&lt;p&gt;That's it for this piece of writing. Next we'll talk about attributes (the fake it till you make it thingy I talked a bit earlier). &lt;/p&gt;

</description>
      <category>html</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Introduction to HTML - Web Development for Toddlers</title>
      <dc:creator>Saurabh Sharma</dc:creator>
      <pubDate>Sun, 13 Mar 2022 20:34:03 +0000</pubDate>
      <link>https://dev.to/devsaurabh/web-development-for-toddlers-2-introduction-to-html-3e4m</link>
      <guid>https://dev.to/devsaurabh/web-development-for-toddlers-2-introduction-to-html-3e4m</guid>
      <description>&lt;p&gt;Computers are dumb.&lt;/p&gt;

&lt;p&gt;They're senseless machines that will do exactly what we ask them to do. If you ask them to kill themselves, they'll do so (Linux users might get it).&lt;/p&gt;

&lt;p&gt;Why did I say that?&lt;br&gt;
Well to tell that the code you write will only work if it's correct.&lt;br&gt;
And that's the mistake almost all beginner programmers make. They make very silly syntax errors (the format that the code should be written in) and end up losing their minds over it.&lt;/p&gt;

&lt;p&gt;HTML is no exception. Though it's not really a programming language, it's a markup language.&lt;br&gt;
Now I won't go into a dictionary to find out what it means but what writing it for a couple of years tells me is that it's a structured language that helps you tell the web browser that you're using what to show and how to show it. (Well CSS does that but we'll get to it in a few chapters).&lt;/p&gt;

&lt;p&gt;HTML stands for HyperText Markup Language. &lt;br&gt;
HyperText simply means a link if that's what you were wondering. A link to another page on the internet (but what is the internet? I might cover this in another chapter).&lt;/p&gt;

&lt;p&gt;Now coming back to it, HTML is what a web browser uses to render (show) content to the user's screen.&lt;/p&gt;

&lt;p&gt;Now over years, there have been multiple updates to the way HTML should be written and rendered (I mean just take a look at computers from 20 years ago and now, there have to be such updates).&lt;/p&gt;

&lt;p&gt;The version that's being used these days is called HTML5.&lt;br&gt;
And we'll be learning some of that here.&lt;/p&gt;

&lt;p&gt;And as I said at the beginning of this article, computers are dumb. There has to be a structure for the code we write. And that structure is called syntax.&lt;br&gt;
Each language has its own set of rules that we need to follow. And as to who makes those rules, well that's a discussion for another day. (Quick answer, it's &lt;a href="https://www.w3.org/"&gt;https://www.w3.org/&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Now that being said, the way a piece of HTML code (or some might call it document) should be structured is very similar to that of a human body (or anatomy? I was always bad at biology).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ugh, what is that?&lt;br&gt;
That's HTML! (🍾)&lt;/p&gt;

&lt;p&gt;Okay but what's with those angle brackets (&amp;lt; and &amp;gt;)?&lt;br&gt;
Those my friends are part of the set of rules or syntax that we talked about earlier. &lt;br&gt;
Computers are dumb, so we need to follow a pattern to make sure they do exactly what we want them to do.&lt;/p&gt;

&lt;p&gt;So let's start by analyzing that piece of code bit by bit.&lt;/p&gt;

&lt;p&gt;We first write &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt;. That's a tag. Or more specifically it's the starting tag for the element that's "html". And it has a counterpart as well! &lt;br&gt;
Did you get that yet? &lt;br&gt;
Voila! it's &lt;code&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;.&lt;br&gt;
They look pretty similar, don't they? But the ending tag (the counterpart), has a forward slash (/) before the "html" element name.&lt;/p&gt;

&lt;p&gt;Also, we'll discuss what "elements" are later on in detail.&lt;/p&gt;

&lt;p&gt;So up to here, we've talked about following a structure when writing code and that there's something called starting and ending tags.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every HTML document or code or file or whatever you'd like to call it should have a root element that's "html".&lt;br&gt;
What does root mean?&lt;br&gt;
Let's recall that anatomy I talked about. &lt;br&gt;
Consider human body for example. It has parts. Mainly head and the rest of your body (well technically there are way too many parts, but just to understand we'll only count these two).&lt;/p&gt;

&lt;p&gt;In terms of an HTML document, that &lt;code&gt;&amp;lt;html&amp;gt;&amp;lt;/html&amp;gt;&lt;/code&gt; denotes the start of your human skeleton as well as the end.&lt;br&gt;
You'd need to put your head inside of it (your head's inside your human frame is it not?).&lt;/p&gt;

&lt;p&gt;So we could write something like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That seems about right!&lt;br&gt;
Now, what about the rest of your body?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wait wait wait...&lt;br&gt;
Can you notice that the body tag is adjacent to the head element and not inside it? That's the correct way to put it!&lt;br&gt;
And now here's where we end that anatomy comparison.&lt;/p&gt;

&lt;p&gt;Let's talk about what an "element" is!&lt;br&gt;
Should we talk about chemistry a bit? Because element sure is a concept there.&lt;br&gt;
Elements together make a compound (if I'm wrong, in my defense I hated my chemistry teacher, hate might be a strong word for it but yes I did).&lt;br&gt;
And that's what elements do in HTML as well!&lt;br&gt;
They're the building blocks of the entire HTML document.&lt;/p&gt;

&lt;p&gt;The root element has a start and end tag &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/html&amp;gt;&lt;/code&gt; respectively.&lt;br&gt;
And the root element has two elements inside of it, "head" and "body".&lt;/p&gt;

&lt;p&gt;Now the people who made the rules decided that the elements that would eventually reside inside "head" shouldn't be displayed in the browser. They're there to store metadata (such as the document's title, other SEO-related elements).&lt;br&gt;
And if these sound made-up things to you, well you can simply ignore the last part.&lt;/p&gt;

&lt;p&gt;They also decided that whatever we write inside the "body" element's start and end tag should be displayed in the browser window.&lt;/p&gt;

&lt;p&gt;Though these are the rules, browsers aren't very strict about that. If you end up writing something that should be in the body, inside the head element, it'd still render (but don't do it! 😠)&lt;/p&gt;

&lt;p&gt;Okay, enough talk.&lt;br&gt;
Open this &lt;a href="https://jsbin.com/?html,output"&gt;JSBin&lt;/a&gt; link.&lt;br&gt;
This tool lets us write HTML and render it as we write it.&lt;/p&gt;

&lt;p&gt;If you open this link, it might look something like this.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8Gx-EDKs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k42lat1zl79wyniocr8m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8Gx-EDKs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k42lat1zl79wyniocr8m.png" alt="A screenshot of JSBin" width="880" height="423"&gt;&lt;/a&gt;&lt;br&gt;
(It might look white to you, I have the dark mode enabled).&lt;/p&gt;

&lt;p&gt;Okay, so scary right! &lt;br&gt;
There's a lot going on in the HTML code editor (the left panel).&lt;br&gt;
Well, fear not!&lt;br&gt;
You can delete the entire code that's there (select all, that's ctrl or cmd + "A" and delete).&lt;/p&gt;

&lt;p&gt;Now write this instead.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    Hello World!
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Woah! Did you see that?&lt;br&gt;
That's your first piece of code! And it works (it did right? 😬)&lt;/p&gt;

&lt;p&gt;If you're wondering why didn't we include "head" in this one, well that's because we don't need it yet.&lt;/p&gt;

&lt;p&gt;Also why "Hello World!"? It's a tradition. Programmers all around the world write code that outputs "Hello World!" to get started with anything. 🙏&lt;/p&gt;

&lt;p&gt;We'll continue with detailed explanation about "elements" in the next chapter!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/devsaurabh/web-development-for-toddlers-1-some-lines-from-me-5bcl"&gt;Link to previous part #1 of this series&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>html</category>
    </item>
    <item>
      <title>Some lines from me - Web Development for Toddlers</title>
      <dc:creator>Saurabh Sharma</dc:creator>
      <pubDate>Sun, 13 Mar 2022 19:52:56 +0000</pubDate>
      <link>https://dev.to/devsaurabh/web-development-for-toddlers-1-some-lines-from-me-5bcl</link>
      <guid>https://dev.to/devsaurabh/web-development-for-toddlers-1-some-lines-from-me-5bcl</guid>
      <description>&lt;p&gt;I know the title's clickbait, but since I've been writing web applications for a couple of years I think it's about time I give back to the community.&lt;/p&gt;

&lt;p&gt;If you'd like to follow along with me through these guides, we'll end up writing apps in HTML, CSS, JavaScript, Vue.js, Laravel with MySQL and Firebase and will host them over Netlify, Firebase (yes it does that as well, in case you didn't know) as well as boot up an Ubuntu instance with LEMP (that's Linux, Nginx, MySQL, and PHP).&lt;br&gt;
You could totally ignore these if they seem too foreign to you. We'll catch up with all of them as we progress.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what's the purpose of this article
&lt;/h2&gt;

&lt;p&gt;You could skip this if you'd like, but I'd like to present my views on why you should learn to make web applications and why to choose the stack that I work with.&lt;/p&gt;

&lt;p&gt;I consider writing code a fun activity. People frequently ask what would you be doing if money wasn't a factor (which is a very unreal scenario considering that we live in a capitalist world), and my answer would be, ... I'd be writing code.&lt;/p&gt;

&lt;p&gt;If writing code doesn't spark something in you, then it'd be just another maths class for you (assuming you didn't like all mathematics lessons lol).&lt;/p&gt;

&lt;p&gt;And if you're still here, then why choose web development?&lt;br&gt;
Why not Android, iOS, or systems applications?&lt;/p&gt;

&lt;p&gt;Should you rather be designing web interfaces in Figma or Adobe Illustrator?&lt;br&gt;
Should you rather be using WordPress to build the blog you want?&lt;br&gt;
Should you rather use a landing page tool just to show some contact information or your photography portfolio?&lt;br&gt;
Should you rather be using Shopify or WooCommerce to build your e-commerce store?&lt;/p&gt;

&lt;p&gt;Or do you want to do it yourself? Want to go through writing thousands of lines of code, in various languages, staring at the screen for hours while stuck on a single bug.&lt;br&gt;
Would it tire you? Do you still want to do it? Do you still have that spark left?&lt;/p&gt;

&lt;p&gt;And if yes, then we'll start with HTML in the next part of this series!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/devsaurabh/web-development-for-toddlers-2-introduction-to-html-3e4m"&gt;Link to part #2 of this series&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Sum of first "n" odd numbers with Python</title>
      <dc:creator>Saurabh Sharma</dc:creator>
      <pubDate>Tue, 03 Sep 2019 13:19:26 +0000</pubDate>
      <link>https://dev.to/devsaurabh/sum-of-first-n-odd-numbers-with-python-4bkm</link>
      <guid>https://dev.to/devsaurabh/sum-of-first-n-odd-numbers-with-python-4bkm</guid>
      <description>&lt;p&gt;It is my first post so ignore any silly mistakes.&lt;br&gt;
Moving onto the topic. As it says I am going to make a python program to find the sum of first “n” odd numbers starting with 1.&lt;br&gt;
Now before you go into my while loop if you are here for quick result. Here is the easiest way to do it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LMLvvVna--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9g6xkgx2s6n10sm37j48.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LMLvvVna--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9g6xkgx2s6n10sm37j48.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now if you are wondering why the heck I print “square of number”, then you may need to go through basic mathematics. Alas! I am a coder man. So head to &lt;a href="https://www.wikihow.com/Add-a-Sequence-of-Consecutive-Odd-Numbers"&gt;this WikiHow post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now coming back to problem. If you are still reading probably you also don’t like such silly and short method.&lt;br&gt;
Welcome to a large solution. (Still small xD)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XQDfY1pS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/8l3tm3c8uz1abv4s121z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XQDfY1pS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/8l3tm3c8uz1abv4s121z.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;HA! Now comes my favourite (favorite if you are American 😄) part.&lt;/p&gt;

&lt;p&gt;Step 1. We take input and convert it to integer. Cause that is string right?&lt;/p&gt;

&lt;p&gt;Step 2. We define some variables. “i” is iterator which will tell when we have reached “n” numbers (If you forgot “n” is the number of odd numbers we have to add). The “current” variable is our sum of numbers which gets updated at every loop (the loop we will write in next step). Initially set to 1, cause that’s our first odd number in Mathematics. And finally we got our lovely variable for which we are writing this all, “sum”. By the way it also gets updated at every loop.&lt;/p&gt;

&lt;p&gt;Step 3. We got our very own while loop. You know what it is right. It keeps on repeating itself until its argument is true. And that argument my readers is the boolean value of “ i &amp;lt; n ”.&lt;br&gt;
Now it means when i becomes equal to n, we stop our loop cause we added them. And print the result. I know what you are thinking. The inner of loop.&lt;br&gt;
Here we have “some” variable being incremented by the value of “current” variable. Which in first iteration is 1 (first odd number), after that we update our “current” variable to next odd number which always is +2, or am I wrong?&lt;br&gt;
Next thing we do is increment our iterator cause without that you know it goes “to infinity and beyond”.&lt;br&gt;
Hope you like it, cause even if you don’t I can do nothing.&lt;/p&gt;

</description>
      <category>python</category>
      <category>code</category>
      <category>developer</category>
      <category>programmer</category>
    </item>
  </channel>
</rss>
