<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Nabin's Blog]]></title><description><![CDATA[Nabin's Blog]]></description><link>https://learnings.olinabin.com.np</link><generator>RSS for Node</generator><lastBuildDate>Mon, 18 May 2026 21:36:34 GMT</lastBuildDate><atom:link href="https://learnings.olinabin.com.np/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[DKAN for rapid and production grade development for Data Science projects]]></title><description><![CDATA[Before, starting the DKAN discussion, I might need to introduce you to Drupal but anyway, I'll introduce you to DKAN first :-) . DKAN is a Drupal module that adds data management functionality. So, now moving back to the Drupal. Drupal is an open sou...]]></description><link>https://learnings.olinabin.com.np/dkan</link><guid isPermaLink="true">https://learnings.olinabin.com.np/dkan</guid><category><![CDATA[dkan]]></category><category><![CDATA[Data Science]]></category><dc:creator><![CDATA[Nabin Oli]]></dc:creator><pubDate>Tue, 16 Jul 2024 03:55:11 GMT</pubDate><content:encoded><![CDATA[<p>Before, starting the DKAN discussion, I might need to introduce you to Drupal but anyway, I'll introduce you to DKAN first :-) . DKAN is a Drupal module that adds data management functionality. So, now moving back to the Drupal. Drupal is an open source CMS software, but it focuses highly on modular aspects. Its major focus is making the every component so modular that you can reuse them in other projects. The main reason for the market of the Drupal is due to its support for the modules. I have been using it for a while for our ongoing project at CAIR-Nepal and I have found every single module required till now. Like for making forms we can use the webforms module.</p>
<h1 id="heading-what-is-dkan">What is DKAN?</h1>
<p>DKAN is a frontend which utilizes backend Drupal for the purpose of the Data Management functionality. Although, its sole goal is data management but you can use it for other tasks too. As its provides like really cool frontend, which is again highly customizable and modifiable according to your need. Cherry on the top, It utilizes the latest technologies and also has support for security patches.</p>
<p>Writing code is not a very big task in itself but for making that piece of code production grade, we must need to have the documentation, testing, security patch support and much more, but with DKAN we can generally get to do that without even needing for team.</p>
<p>Now, that you came to know about what is DKAN, now lets move to installation part.</p>
<h3 id="heading-here-is-a-list-of-resources-you-can-use-for-installing-and-making-the-dkan-run">Here is a list of resources you can use for installing and making the DKAN run.</h3>
<ol>
<li><p>Install Docker for running DDEV. You can find the installation instructions <a target="_blank" href="https://ddev.readthedocs.io/en/latest/users/install/docker-installation/">here</a>.</p>
</li>
<li><p>Install DDEV by following the instructions provided <a target="_blank" href="https://ddev.readthedocs.io/en/latest/users/install/ddev-installation">here</a>.</p>
</li>
<li><p>Install DKAN <a target="_blank" href="https://dkan.readthedocs.io/en/latest/">here</a> .</p>
</li>
</ol>
<h3 id="heading-docker">Docker:</h3>
<p>Docker is a containerization mechanism for making the consistent environment for running your applications. Containerization very convenient as it allows us to easily ship applications whether it is for deploying or for sharing with fellow developers.</p>
<h3 id="heading-ddev">DDEV:</h3>
<p>DDEV is an open-source tool designed to simplify the setup and management of local development environments for PHP-based web applications, especially those built with content management systems (CMS) like Drupal, WordPress, TYPO3, and others. It leverages Docker to create isolated environments, making it easier for developers to manage dependencies and configurations.</p>
<h3 id="heading-happy-coding">Happy coding</h3>
<p>Keep learning : )</p>
]]></content:encoded></item><item><title><![CDATA[Commands that I learnt today! (Vim + Linux)]]></title><description><![CDATA[Later, these days I have realized there should be place or consideration for coding productivity like use of some sorts of tools, that makes your wrist have lesser pain. I found that there are tools like Vim editor extensions that are available for V...]]></description><link>https://learnings.olinabin.com.np/commands-that-i-learnt-today-vim-linux</link><guid isPermaLink="true">https://learnings.olinabin.com.np/commands-that-i-learnt-today-vim-linux</guid><dc:creator><![CDATA[Nabin Oli]]></dc:creator><pubDate>Sat, 30 Dec 2023 14:56:05 GMT</pubDate><content:encoded><![CDATA[<p>Later, these days I have realized there should be place or consideration for coding productivity like use of some sorts of tools, that makes your wrist have lesser pain. I found that there are tools like Vim editor extensions that are available for VS code that can be used for boosting productivity while coding. It enhances don't touch your mouse principle which will make you do things faster while coding by enabling your hand to stay at keyboard most of the time.</p>
<hr />
<h1 id="heading-vim-commands">VIM commands</h1>
<p>Vim commands are the core of Vim's functionality, allowing efficient text editing, navigation, and interaction with the editor. Vim commands can be executed in different modes.</p>
<h3 id="heading-modes-in-vim">Modes in Vim:</h3>
<ol>
<li><p><strong>Normal Mode:</strong> The default mode for navigation and executing commands.</p>
</li>
<li><p><strong>Insert Mode:</strong> For inserting and editing text.</p>
</li>
<li><p><strong>Visual Mode:</strong> For selecting text visually.</p>
</li>
<li><p><strong>Command-Line Mode:</strong> For entering editor commands.</p>
</li>
</ol>
<p>Now, Let's see some commands:</p>
<ol>
<li><p><strong>Entering Insert Mode:</strong></p>
<ul>
<li><p><code>i</code> or <code>I</code>: Insert mode before/after the cursor.</p>
</li>
<li><p><code>a</code> or <code>A</code>: Insert mode after the cursor/end of the line.</p>
</li>
<li><p><code>o</code> or <code>O</code>: Open a new line below/above the current line for insertion.</p>
</li>
</ul>
</li>
<li><p><strong>Exiting Insert Mode:</strong></p>
<ul>
<li><code>Esc</code>: Exit from insert mode to normal mode.</li>
</ul>
</li>
<li><p><strong>Navigation in Normal Mode:</strong></p>
<ul>
<li><p><code>h</code>, <code>j</code>, <code>k</code>, <code>l</code>: Left, down, up, right (respectively) navigation.</p>
</li>
<li><p><code>w</code>, <code>b</code>: Move forward/backward by a word.</p>
</li>
<li><p><code>gg</code>, <code>G</code>: Move to the start/end of the document.</p>
</li>
<li><p><code>^</code>, <code>$</code>: Move to the start/end of the line.</p>
</li>
<li><p><code>Ctrl + u</code>, <code>Ctrl + d</code>: Scroll up/down.</p>
</li>
</ul>
</li>
<li><p><strong>Visual Mode:</strong></p>
<ul>
<li><p><code>v</code>: Start character-based visual mode.</p>
</li>
<li><p><code>V</code>: Start line-based visual mode.</p>
</li>
<li><p><code>Ctrl + v</code>: Start block-based visual mode.</p>
</li>
</ul>
</li>
<li><p><strong>Copying and Pasting:</strong></p>
<ul>
<li><p><code>y</code>: Yank (copy) selected text.</p>
</li>
<li><p><code>p</code>: Paste text after the cursor.</p>
</li>
<li><p><code>P</code>: Paste text before the cursor.</p>
</li>
</ul>
</li>
<li><p><strong>Deleting:</strong></p>
<ul>
<li><p><code>x</code>: Delete character under the cursor.</p>
</li>
<li><p><code>dd</code>: Delete the entire line.</p>
</li>
<li><p><code>dw</code>: Delete word.</p>
</li>
<li><p><code>d$</code>, <code>d^</code>: Delete to the end/beginning of the line.</p>
</li>
</ul>
</li>
<li><p><strong>Search and Replace:</strong></p>
<ul>
<li><p><code>/</code>: Search forward.</p>
</li>
<li><p><code>?</code>: Search backward.</p>
</li>
<li><p><code>:s/old/new/g</code>: Replace 'old' with 'new' globally in the line.</p>
</li>
<li><p><code>:%s/old/new/g</code>: Replace 'old' with 'new' globally in the entire file.</p>
</li>
</ul>
</li>
</ol>
<p>These shortcuts are fundamental in Vim and have significantly sped up my productivity with less interaction with mouse.</p>
<hr />
<h1 id="heading-some-linux-commands">Some linux Commands</h1>
<p>These are some Linux commands I learnt today:</p>
<h3 id="heading-pipe">Pipe: |</h3>
<p>In Linux, the pipe <code>|</code> is a powerful operator used to combine two or more commands together, allowing the output of one command to be used as the input for another. It's used for creating a data flow between commands, enabling you to perform complex operations by chaining multiple commands together.</p>
<h3 id="heading-grep">grep</h3>
<p>A grep is a command line utility for searching plain-text for lines that match a regular expressions.</p>
<pre><code class="lang-bash">ls | grep names.txt
</code></pre>
<p>This command will display any files in the current directory that match the name <code>"names.txt"</code>.</p>
<p>If you have an idea of the beginning of the file name or its specific pattern, you can use a wildcard character (<code>*</code>) to match parts of the filename</p>
<pre><code class="lang-bash">ls | first_names*
</code></pre>
<p><strong>Alternative for grep in Powershell</strong></p>
<pre><code class="lang-bash">Get-ChildItem | Where-Object { <span class="hljs-variable">$_</span>.Name -like <span class="hljs-string">'*first*'</span> }
</code></pre>
<p>This command will list files in the current directory containing "first" in their names.</p>
<h3 id="heading-rm">rm</h3>
<p><code>rm</code> stands for "remove." It's used to delete files or directories. For example, to delete a file named <code>"names.txt"</code></p>
<pre><code class="lang-bash">rm names.txt
</code></pre>
<h3 id="heading-cp">cp</h3>
<p><code>cp</code> stands for "copy." It's used to copy files or directories. For example, to copy a file named "source.txt" to a new file "destination.txt":</p>
<pre><code class="lang-bash">cp source.txt destination.txt
</code></pre>
<p>If you are reading till here thank you for reading. Keep learning! Keep growing!</p>
]]></content:encoded></item><item><title><![CDATA[Importing Different Types of Data Files in Python Using Pandas(Part 01)]]></title><description><![CDATA[Python, with its powerful data manipulation and analysis library called Pandas, is a popular choice for working with diverse types of data files. Pandas provide convenient functions to read and import various file formats, making it an excellent tool...]]></description><link>https://learnings.olinabin.com.np/importing-different-types-of-data-files-in-python-using-pandaspart-01</link><guid isPermaLink="true">https://learnings.olinabin.com.np/importing-different-types-of-data-files-in-python-using-pandaspart-01</guid><dc:creator><![CDATA[Nabin Oli]]></dc:creator><pubDate>Mon, 25 Sep 2023 15:50:03 GMT</pubDate><content:encoded><![CDATA[<p>Python, with its powerful data manipulation and analysis library called Pandas, is a popular choice for working with diverse types of data files. Pandas provide convenient functions to read and import various file formats, making it an excellent tool for data processing and analysis. In this blog post, we'll explore how to import different types of data files using Pandas.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ol>
<li><p><strong>CSV (Comma-Separated Values) Files</strong></p>
</li>
<li><p><strong>Excel Files (.xlsx, .xls)</strong></p>
</li>
<li><p><strong>JSON (JavaScript Object Notation) Files</strong></p>
</li>
<li><p><strong>Text Files (TXT)</strong></p>
</li>
<li><p><strong>HTML Data</strong></p>
</li>
<li><p><strong>HDF (Hierarchical Data Format) Files</strong></p>
</li>
</ol>
<h2 id="heading-1-csv-comma-separated-values-files">1. CSV (Comma-Separated Values) Files</h2>
<p>CSV files are one of the most common and versatile formats for storing tabular data. Pandas provides a simple method, <code>read_csv()</code>, to read CSV files into a data frame.</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-comment"># Reading a CSV file into a DataFrame</span>
df = pd.read_csv(<span class="hljs-string">'path_to_csv_file.csv'</span>)
</code></pre>
<h2 id="heading-2-excel-files-xlsx-xls">2. Excel Files (.xlsx, .xls)</h2>
<p>To read Excel files, Pandas offers the <code>read_excel()</code> function. You can specify the sheet name or index to read the data from a particular sheet.</p>
<pre><code class="lang-python"><span class="hljs-comment"># Reading an Excel file into a DataFrame</span>
df = pd.read_excel(<span class="hljs-string">'path_to_excel_file.xlsx'</span>, sheet_name=<span class="hljs-string">'Sheet1'</span>)
</code></pre>
<h2 id="heading-3-json-javascript-object-notation-files">3. JSON (JavaScript Object Notation) Files</h2>
<p>JSON files are often used to store semi-structured or nested data. Pandas support reading JSON data using <code>read_json()</code>.</p>
<pre><code class="lang-python"><span class="hljs-comment"># Reading a JSON file into a DataFrame</span>
df = pd.read_json(<span class="hljs-string">'path_to_json_file.json'</span>)
</code></pre>
<h2 id="heading-4-text-files-txt">4. Text Files (TXT)</h2>
<p>Pandas allow you to read text files with fixed or variable delimiters using <code>read_table()</code>.</p>
<pre><code class="lang-python"><span class="hljs-comment"># Reading a text file with a specific delimiter into a DataFrame</span>
df = pd.read_table(<span class="hljs-string">'path_to_text_file.txt'</span>, delimiter=<span class="hljs-string">';'</span>)
</code></pre>
<h2 id="heading-5-html-data">5. HTML Data</h2>
<p>To scrape tables from HTML pages, you can use the <code>read_html()</code> function.</p>
<pre><code class="lang-python"><span class="hljs-comment"># Reading HTML tables into a list of DataFrames</span>
dfs = pd.read_html(<span class="hljs-string">'https://example.com/page_with_table.html'</span>)

<span class="hljs-comment"># Accessing the DataFrame from the list (if more than one table)</span>
df = dfs[<span class="hljs-number">0</span>]
</code></pre>
<h2 id="heading-6-hdf-hierarchical-data-format-files">6. HDF (Hierarchical Data Format) Files</h2>
<p>HDF is a file format to store and organize large amounts of numerical data. Pandas support HDF5 format using <code>read_hdf()</code>.</p>
<pre><code class="lang-python"><span class="hljs-comment"># Reading an HDF5 file into a DataFrame</span>
df = pd.read_hdf(<span class="hljs-string">'path_to_hdf_file.h5'</span>, key=<span class="hljs-string">'data'</span>)
</code></pre>
<p>In this blog post, we've explored how to import various types of data files using Pandas, a versatile and efficient library for data analysis in Python. With these techniques, you can efficiently read and work with different types of data, paving the way for insightful analysis and meaningful insights. Happy data processing!</p>
]]></content:encoded></item><item><title><![CDATA[Demystifying the Birthday Problem: Paradox or Perplexity?]]></title><description><![CDATA[Welcome to this in-depth exploration of the fascinating "Birthday Problem" - a classic probability puzzle that often perplexes and surprises people. We'll unravel the mystery and gain a comprehensive understanding of this intriguing mathematical phen...]]></description><link>https://learnings.olinabin.com.np/demystifying-the-birthday-problem-paradox-or-perplexity</link><guid isPermaLink="true">https://learnings.olinabin.com.np/demystifying-the-birthday-problem-paradox-or-perplexity</guid><dc:creator><![CDATA[Nabin Oli]]></dc:creator><pubDate>Tue, 19 Sep 2023 06:55:49 GMT</pubDate><content:encoded><![CDATA[<p>Welcome to this in-depth exploration of the fascinating "Birthday Problem" - a classic probability puzzle that often perplexes and surprises people. We'll unravel the mystery and gain a comprehensive understanding of this intriguing mathematical phenomenon.</p>
<h2 id="heading-introduction">Introduction</h2>
<p>The Birthday Problem, also known as the Birthday Paradox, is a famous problem in probability theory. It might seem counterintuitive at first, but it's a great example of how probabilities can work in unexpected ways. Let's start by understanding the problem statement.</p>
<h2 id="heading-the-birthday-problem-explained">The Birthday Problem Explained</h2>
<p>Imagine you are in a room with a group of people. How many people do you need in the room for there to be a 50% chance that at least two people share the same birthday? Surprisingly, the answer is just 23! With 23 people, the probability of two people having the same birthday is approximately 50.73%.</p>
<p>To fully grasp this concept, we'll break down the problem into understandable parts.</p>
<h2 id="heading-understanding-the-probability-calculation">Understanding the Probability Calculation</h2>
<p>The probability of no one sharing a birthday can be calculated as follows:</p>
<ul>
<li><p>For the first person, there are 365 possible birthdays (assuming a non-leap year).</p>
</li>
<li><p>For the second person, there are 364 possible birthdays (excluding the birthday of the first person).</p>
</li>
<li><p>For the third person, there are 363 possible birthdays (excluding the birthdays of the first and second persons).</p>
</li>
<li><p>And so on, until the 23rd person with 343 possible birthdays.</p>
</li>
</ul>
<p>So, the probability of no one sharing a birthday in a group of 23 people can be calculated as:</p>
<p>$$[ P(\text{No shared birthday}) = \frac{365}{365} \times \frac{364}{365} \times \frac{363}{365} \times \ldots \times \frac{343}{365} ]$$</p><p>The probability of at least two people sharing a birthday is the complement of the above probability:</p>
<p>$$[ P(\text{At least one shared birthday}) = 1 - P(\text{No shared birthday}) ]$$</p><h2 id="heading-factors-influencing-the-probability">Factors Influencing the Probability</h2>
<ol>
<li><strong>Number of People (n)</strong>: As the number of people increases, the probability of shared birthdays increases dramatically.</li>
</ol>
<p><strong>Number of Possible Birthdays (k)</strong>: In our calculations, we assumed 365 possible birthdays. If considering leap years, this number becomes 366.</p>
<p>Is it a paradox, but first let's discuss, what is paradox</p>
<h1 id="heading-what-is-paradox">What is Paradox?</h1>
<p>A paradox is a statement or situation that seems contradictory or self-defeating, defying common sense or logical interpretation. It challenges our understanding and expectations, often leading to confusion or an apparent conflict between ideas. Despite its contradictory nature, a paradox may hold deeper truths or reveal complexities that merit careful analysis. In essence, it's a thought-provoking puzzle that invites reevaluation of preconceived notions.</p>
<h2 id="heading-why-is-it-a-paradox">Why is it a "Paradox"?</h2>
<p>The counterintuitive nature of the Birthday Problem arises from our expectations. People often underestimate the number of individuals needed for a significant probability of shared birthdays. Intuitively, we might think we need a much larger group to have a 50% chance of shared birthdays.</p>
<h2 id="heading-real-world-applications">Real-World Applications</h2>
<p>Understanding the Birthday Problem has practical applications in various fields, such as:</p>
<ul>
<li><p><strong>Cryptography</strong>: In the field of cryptography, understanding the probability of collisions (two different inputs producing the same output) is crucial for designing secure algorithms.</p>
</li>
<li><p><strong>Social Planning</strong>: Event planners, especially for large gatherings, need to consider the likelihood of shared birthdays when organizing events.</p>
</li>
<li><p><strong>Healthcare Planning</strong>: Hospitals and healthcare facilities can utilize similar probability principles when planning resources and staff for potential spikes inpatient admissions, especially during flu seasons or other contagious outbreaks.</p>
</li>
<li><p><strong>Marketing and Customer Analysis</strong>: Marketing strategists often leverage probability concepts to predict customer behavior and segment target audiences, assisting in tailored advertising campaigns and product launches.</p>
</li>
<li><p><strong>Data Deduplication and Database Management</strong>: In data management, understanding the likelihood of duplicate entries or collisions is vital for efficient database design, data deduplication, and ensuring accurate records.</p>
</li>
<li><p><strong>Insurance and Risk Assessment</strong>: Actuaries and insurance companies employ probability theories to evaluate risks and determine insurance premiums, considering the likelihood of various events occurring over a policy term.</p>
</li>
</ul>
<p>The Birthday Problem is a captivating example of how probability can challenge our intuitions. By applying simple calculations, we unveil surprising insights into the likelihood of shared birthdays in a group. This probability puzzle continues to intrigue and educate, showcasing the beauty and complexity of mathematics. Next time you're in a room with a group of people, you might just be the one to amaze them with this probability paradox!</p>
<h3 id="heading-next-blog-on-bayes-theorem-and-naive-bayes-model">Next Blog on, Bayes Theorem and Naive Bayes Model:)</h3>
<h3 id="heading-keep-learning-keep-growing"><strong>Keep learning, Keep growing!</strong></h3>
]]></content:encoded></item><item><title><![CDATA[Selenium - Let's Extract WEB]]></title><description><![CDATA[Syllabus:
Introduction to Selenium WebDriver

Introduction to Selenium and its features

Understanding the Selenium WebDriver architecture

Setting up the development environment (Python, Selenium, WebDriver, etc.)


Locating Elements

Locating eleme...]]></description><link>https://learnings.olinabin.com.np/selenium-lets-extract-web</link><guid isPermaLink="true">https://learnings.olinabin.com.np/selenium-lets-extract-web</guid><dc:creator><![CDATA[Nabin Oli]]></dc:creator><pubDate>Thu, 29 Jun 2023 13:45:26 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-syllabus">Syllabus:</h2>
<p><strong>Introduction to Selenium WebDriver</strong></p>
<ul>
<li><p>Introduction to Selenium and its features</p>
</li>
<li><p>Understanding the Selenium WebDriver architecture</p>
</li>
<li><p>Setting up the development environment (Python, Selenium, WebDriver, etc.)</p>
</li>
</ul>
<p><strong>Locating Elements</strong></p>
<ul>
<li><p>Locating elements on a web page using various methods:</p>
<ul>
<li>By ID, class name, tag name, name, link text, partial link text, CSS selectors, and XPath</li>
</ul>
</li>
</ul>
<p><strong>Interacting with Elements</strong></p>
<ul>
<li><p>Clicking elements</p>
</li>
<li><p>Typing and entering text into input fields</p>
</li>
<li><p>Selecting options from dropdowns</p>
</li>
<li><p>Handling checkboxes and radio buttons</p>
</li>
<li><p>Uploading files</p>
</li>
<li><p>Performing mouse actions (hover, right-click, etc.)</p>
</li>
<li><p>Executing JavaScript</p>
</li>
</ul>
<p><strong>Working with Windows and Frames</strong></p>
<ul>
<li><p>Switching between windows and frames</p>
</li>
<li><p>Handling multiple windows and pop-ups</p>
</li>
</ul>
<p><strong>Synchronization and Waits</strong></p>
<ul>
<li><p>Implicit waits</p>
</li>
<li><p>Explicit waits with expected conditions</p>
</li>
<li><p>Handling AJAX calls and dynamic elements</p>
</li>
<li><p>FluentWait for custom conditions</p>
</li>
</ul>
<p><strong>Handling Alerts, Confirmations, and Prompts</strong></p>
<ul>
<li><p>Accepting, dismissing, and sending text to alerts</p>
</li>
<li><p>Handling confirmation dialogs and prompts</p>
</li>
</ul>
<p><strong>Working with Cookies</strong></p>
<ul>
<li>Managing cookies (adding, deleting, etc.)</li>
</ul>
<p><strong>Capturing Screenshots and Logging</strong></p>
<ul>
<li><p>Taking screenshots of web pages</p>
</li>
<li><p>Logging actions and events</p>
</li>
</ul>
<p><strong>Handling Dropdowns</strong></p>
<ul>
<li>Handling dropdown menus and select options</li>
</ul>
<p><strong>Handling Frames and iFrames</strong></p>
<ul>
<li>Switching to frames and interacting with elements inside frames</li>
</ul>
<p><strong>Handling Browser Windows and Tabs</strong></p>
<ul>
<li><p>Opening new windows and tabs</p>
</li>
<li><p>Switching between windows and tabs</p>
</li>
<li><p>Closing windows and tabs</p>
</li>
</ul>
<p><strong>Handling Actions and Keyboard Events</strong></p>
<ul>
<li><p>Performing advanced user interactions (drag and drop, double-click, etc.)</p>
</li>
<li><p>Simulating keyboard events (key presses, key releases, etc.)</p>
</li>
</ul>
<p><strong>Handling Dynamic Web Elements</strong></p>
<ul>
<li>Handling elements with dynamic IDs, names, or attributes</li>
</ul>
<p><strong>Handling JavaScript Alerts, Prompts, and Confirmations</strong></p>
<ul>
<li><p>Executing JavaScript code on web pages</p>
</li>
<li><p>Handling various JavaScript alerts, prompts, and confirmations</p>
</li>
</ul>
<p><strong>Handling Browser Navigation</strong></p>
<ul>
<li>Navigating back, forward, and refreshing web pages</li>
</ul>
<p><strong>Page Object Model (POM)</strong></p>
<ul>
<li><p>Introduction to POM</p>
</li>
<li><p>Designing and implementing a POM framework</p>
</li>
</ul>
<p><strong>Handling Web Tables</strong></p>
<ul>
<li>Reading and extracting data from HTML tables</li>
</ul>
<p><strong>Handling Web Forms</strong></p>
<ul>
<li><p>Automating form submission</p>
</li>
<li><p>Validating form fields</p>
</li>
</ul>
<p><strong>Data Driven Testing</strong></p>
<ul>
<li><p>Reading test data from external files (Excel, CSV, etc.)</p>
</li>
<li><p>Parameterizing tests with test data</p>
</li>
</ul>
<p><strong>Test Frameworks and Reporting</strong></p>
<ul>
<li><p>Introduction to test frameworks (unittest, pytest, etc.)</p>
</li>
<li><p>Test case organization and structuring</p>
</li>
<li><p>Generating test reports</p>
</li>
</ul>
<p><strong>Parallel Execution and Cross-Browser Testing</strong></p>
<ul>
<li><p>Running tests in parallel</p>
</li>
<li><p>Running tests on different browsers (Chrome, Firefox, etc.)</p>
</li>
</ul>
<p><strong>Introduction to Selenium Grid</strong></p>
<ul>
<li>Distributed test execution using Selenium Grid</li>
</ul>
<p>This syllabus covers the fundamental concepts and techniques of Selenium WebDriver with Python. It provides a comprehensive foundation for automating web applications using Selenium. Keep in mind that this syllabus can be customized based on your specific learning goals and requirements.</p>
<h1 id="heading-resources">Resources</h1>
<p><strong>Introduction to Selenium WebDriver</strong></p>
<p><a target="_blank" href="https://en.wikipedia.org/wiki/Selenium_(software)">For History of Selenium and Other information about it</a></p>
<p><strong>The architecture of Selenium WebDriver consists of the following:</strong></p>
<ul>
<li><p>Selenium Client Library</p>
</li>
<li><p>JSON WIRE PROTOCOL Over HTTP Client</p>
</li>
<li><p>Browser Drivers</p>
</li>
<li><p>Browsers</p>
</li>
</ul>
<p><strong>1- Selenium Client Library</strong></p>
<p>The Selenium Client Library consists of various language libraries for Java, Ruby, Python, and other supported languages.</p>
<p><strong>2- JSON WIRE PROTOCOL Over HTTP Client</strong></p>
<p>JSON denotes Javascript Object Notation. This component of the Selenium WebDriver plays an important role in the Selenium automation process by transferring data between the server and a client on the web.</p>
<p><strong>3-  Browser Drivers</strong></p>
<p>Browser drivers are used to carry out the communication between the Selenium WebDriver and the respective browser. The Browser drivers ensure that no details are revealed to the browser regarding the internal logic of the functionalities of the browser.</p>
<p><strong>4- Browsers</strong></p>
<p>As already discussed above, the browsers supported are Firefox, Safari, Chrome, and more.</p>
<h3 id="heading-selenium-grid"><strong>Selenium Grid</strong></h3>
<p>This component of the Selenium suite works together clubbed with the Selenium RC. It is used to run parallel tests on machines against their respective browsers. The working of Selenium Grid depends on the browsers and operating systems supported by the entire framework. Since almost all browsers and operating systems are supported by Selenium, it is easier for the Selenium Grid to run multiple tests at the same time against different machines with different browsers.</p>
<h1 id="heading-setting-up-development-environment">Setting Up Development Environment</h1>
<p>&lt;---LEFT--&gt;</p>
<h2 id="heading-locating-elements"><strong>Locating Elements</strong></h2>
<ol>
<li>By.XX</li>
</ol>
<p>Be sure to first import this:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> selenium.webdriver.common.by <span class="hljs-keyword">import</span> By
</code></pre>
<pre><code class="lang-python">find_element(By.ID, <span class="hljs-string">"id"</span>)
find_element(By.NAME, <span class="hljs-string">"name"</span>)
find_element(By.XPATH, <span class="hljs-string">"xpath"</span>)
find_element(By.LINK_TEXT, <span class="hljs-string">"link text"</span>)
find_element(By.PARTIAL_LINK_TEXT, <span class="hljs-string">"partial link text"</span>)
find_element(By.TAG_NAME, <span class="hljs-string">"tag name"</span>)
find_element(By.CLASS_NAME, <span class="hljs-string">"class name"</span>)
find_element(By.CSS_SELECTOR, <span class="hljs-string">"css selector"</span>)
</code></pre>
<h1 id="heading-interacting-with-elements">Interacting with Elements</h1>
<ol>
<li><p>Navigating</p>
<pre><code class="lang-python"> <span class="hljs-keyword">from</span> selenium <span class="hljs-keyword">import</span> webdriver
 driver.get(<span class="hljs-string">"http://www.google.com"</span>)
</code></pre>
</li>
<li><p>Interacting with the page</p>
<pre><code class="lang-python"> <span class="hljs-keyword">from</span> selenium <span class="hljs-keyword">import</span> webdriver
 <span class="hljs-keyword">from</span> selenium.webdriver.common.by <span class="hljs-keyword">import</span> By

 element = driver.find_element(By.ID, <span class="hljs-string">"passwd-id"</span>)
 element.send_keys(<span class="hljs-string">"some text"</span>)
</code></pre>
</li>
<li><p>Filling in Forms</p>
<pre><code class="lang-python"> <span class="hljs-keyword">from</span> selenium <span class="hljs-keyword">import</span> webdriver
 <span class="hljs-keyword">from</span> selenium.webdriver.common.by <span class="hljs-keyword">import</span> By
 <span class="hljs-keyword">from</span> selenium.webdriver.support.ui <span class="hljs-keyword">import</span> Select

 select = Select(driver.find_element(By.NAME, <span class="hljs-string">'name'</span>))
 select.select_by_index(index)
</code></pre>
</li>
<li><p>Drag and Drop</p>
<pre><code class="lang-python"> <span class="hljs-keyword">from</span> selenium <span class="hljs-keyword">import</span> webdriver
 <span class="hljs-keyword">from</span> selenium.webdriver <span class="hljs-keyword">import</span> ActionChains
 <span class="hljs-keyword">from</span> selenium.webdriver.common.by <span class="hljs-keyword">import</span> By

 ActionChains(driver).drag_and_drop(element, target).perform()
</code></pre>
</li>
<li><p>Moving between Windows and Frames</p>
<pre><code class="lang-python"> <span class="hljs-keyword">from</span> selenium <span class="hljs-keyword">import</span> webdriver

 driver.switch_to.window(<span class="hljs-string">"windowName"</span>)
</code></pre>
</li>
<li><p>Popup Dialogs</p>
</li>
</ol>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> selenium <span class="hljs-keyword">import</span> webdriver

alert = driver.switch_to.alert
</code></pre>
<ol>
<li>Navigation: History and Location</li>
</ol>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> selenium <span class="hljs-keyword">import</span> webdriver

driver.forward()
</code></pre>
<ol>
<li>Cookies</li>
</ol>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> selenium <span class="hljs-keyword">import</span> webdriver

driver.add_cookie({<span class="hljs-string">'name'</span>: <span class="hljs-string">'foo'</span>, <span class="hljs-string">'value'</span>: <span class="hljs-string">'bar'</span>})
</code></pre>
]]></content:encoded></item><item><title><![CDATA[NUMPY - NUMerical PYthon]]></title><description><![CDATA[NumPy (Numerical Python) is an open-source Python library that’s used in almost every field of science and engineering. It’s the universal standard for working with numerical data in Python, and it’s at the core of the scientific Python and PyData ec...]]></description><link>https://learnings.olinabin.com.np/numpy-numerical-python</link><guid isPermaLink="true">https://learnings.olinabin.com.np/numpy-numerical-python</guid><dc:creator><![CDATA[Nabin Oli]]></dc:creator><pubDate>Sat, 24 Jun 2023 07:21:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1687591234880/468b5d43-672a-47e8-ada3-1db33825b509.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>NumPy (<strong>Numerical Python</strong>) is an open-source Python library that’s used in almost every field of science and engineering. It’s the universal standard for working with numerical data in Python, and it’s at the core of the scientific Python and PyData ecosystems.</p>
<p>The NumPy API is used extensively in Pandas, SciPy, Matplotlib, sci-kit-learn, sci-kit-image and most other data science and scientific Python packages.</p>
<ol>
<li><p>It provides <strong>ndarray</strong>, a homogeneous n-dimensional array object, with methods to efficiently operate on it.</p>
</li>
<li><p>It adds powerful data structures to Python that guarantee efficient calculations with arrays and matrices and it supplies an enormous library of high-level mathematical functions that operate on these arrays and matrices.</p>
</li>
</ol>
<h3 id="heading-installing-numpy">Installing NumPy</h3>
<pre><code class="lang-python">conda install numpy
</code></pre>
<p>or</p>
<pre><code class="lang-python">pip install numpy
</code></pre>
<h3 id="heading-importing-numpy">Importing NumPy</h3>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
</code></pre>
<h2 id="heading-difference-between-a-python-list-and-a-numpy-array">Difference between a Python list and a NumPy array?</h2>
<p>NumPy gives you an enormous range of fast and efficient ways of creating arrays and manipulating numerical data inside them. While a Python list can contain different data types within a single list, all of the elements in a NumPy array should be homogeneous. The mathematical operations that are meant to be performed on arrays would be extremely inefficient if the arrays weren’t homogeneous..</p>
<ol>
<li>An array consumes less memory and is convenient to use.</li>
</ol>
<h2 id="heading-what-is-an-array">What is an array?</h2>
<p>An array is a central data structure of the NumPy library. An array is a grid of values and it contains information about the raw data, how to locate an element, and how to interpret an element.</p>
<h3 id="heading-other">Other:</h3>
<p>The <code>rank</code> of the array is the number of dimensions. The <code>shape</code> of the array is a tuple of integers giving the size of the array along each dimension.</p>
<pre><code class="lang-python">print(a[<span class="hljs-number">0</span>])
</code></pre>
<h2 id="heading-what-are-the-attributes-of-an-array">What are the attributes of an array?</h2>
<p>An array is usually a fixed-size container of items of the same type and size. The number of dimensions and items in an array is defined by its shape. The shape of an array is a tuple of non-negative integers that specify the sizes of each dimension</p>
<p><strong>dimensions are called axes</strong></p>
<p>Array <strong>attributes</strong> reflect information intrinsic to the array itself. If you need to get, or even set, properties of an array without creating a new array, you can often access an array through its attributes.</p>
<h2 id="heading-how-to-create-a-basic-array">How to create a Basic array?</h2>
<ol>
<li><p><code>np.array()</code></p>
</li>
<li><p><code>np.zeros()</code></p>
</li>
<li><p><code>np.ones()</code></p>
</li>
<li><p><code>np.empty()</code></p>
</li>
<li><p><code>np.arange()</code></p>
</li>
<li><p><code>np..linspace()</code></p>
</li>
<li><p><code>dtype</code></p>
</li>
</ol>
<p>You can also use <code>np.linspace()</code> to create an array with values that are spaced linearly in a specified interval.</p>
<p><code>dtype=np.int64</code></p>
<h2 id="heading-adding-removing-and-sorting-elements">Adding, removing, and sorting elements</h2>
<ol>
<li><p><code>np.sort()</code></p>
</li>
<li><p><code>np.concatenate()</code></p>
</li>
</ol>
<p>In addition to sort, which returns a sorted copy of an array, you can use:</p>
<ul>
<li><p><code>[argsort](&lt;</code><a target="_blank" href="https://numpy.org/doc/stable/reference/generated/numpy.argsort.html#numpy.argsort"><code>https://numpy.org/doc/stable/reference/generated/numpy.argsort.html#numpy.argsort</code></a><code>&gt;)</code>, which is an indirect sort along a specified axis,</p>
</li>
<li><p><code>[lexsort](&lt;</code><a target="_blank" href="https://numpy.org/doc/stable/reference/generated/numpy.lexsort.html#numpy.lexsort"><code>https://numpy.org/doc/stable/reference/generated/numpy.lexsort.html#numpy.lexsort</code></a><code>&gt;)</code>, which is an indirect stable sort on multiple keys,</p>
</li>
<li><p><code>[searchsorted](&lt;</code><a target="_blank" href="https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html#numpy.searchsorted"><code>https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html#numpy.searchsorted</code></a><code>&gt;)</code>, which will find elements in a sorted array, and</p>
</li>
<li><p><code>[partition](&lt;</code><a target="_blank" href="https://numpy.org/doc/stable/reference/generated/numpy.partition.html#numpy.partition"><code>https://numpy.org/doc/stable/reference/generated/numpy.partition.html#numpy.partition</code></a><code>&gt;)</code>, which is a partial sort.</p>
</li>
</ul>
<h2 id="heading-how-to-know-the-shape-and-size-of-an-array">How to know the shape and size of an array?</h2>
<ol>
<li><p><code>ndarray.ndim</code></p>
</li>
<li><p><code>ndarray.size</code></p>
</li>
<li><p><code>nadarray.shape</code></p>
</li>
</ol>
<p><code>ndarray.ndim</code> will tell you the number of axes, or dimensions, of the array.</p>
<p><code>ndarray.size</code> will tell you the total number of elements of the array. This is the <em>product</em> of the elements of the array’s shape.</p>
<p><code>ndarray.shape</code> will display a tuple of integers that indicate the number of elements stored along each dimension of the array. If, for example, you have a 2-D array with 2 rows and 3 columns, the shape of your array is <code>(2, 3)</code>.</p>
<h2 id="heading-can-you-reshape-an-array">Can you reshape an array?</h2>
<ol>
<li><code>arr.reshape()</code></li>
</ol>
<p>Using <code>arr.reshape()</code> will give a new shape to an array without changing the data. Just remember that when you use the reshape method, the array you want to produce needs to have the same number of elements as the original array. If you start with an array with 12 elements, you’ll need to make sure that your new array also has a total of 12 elements.</p>
<p><code>a</code> is the array to be reshaped.</p>
<p><code>newshape</code> is the new shape you want. You can specify an integer or a tuple of integers. If you specify an integer, the result will be an array of that length. The shape should be compatible with the original shape.</p>
<p><code>order:</code> <code>C</code> means to read/write the elements using C-like index order,<code>F</code> means to read/write the elements using Fortran-like index order, <code>A</code> means to read/write the elements in Fortran-like index order if a is Fortran contiguous in memory, C-like order otherwise. (This is an optional parameter and doesn’t need to be specified.)</p>
<p>&lt;aside&gt; 💡 Read more about internal organization of NumPy arrays here.</p>
<p>&lt;/aside&gt;</p>
<h2 id="heading-how-to-convert-a-1d-array-into-a-2d-array-how-to-add-a-new-axis-to-an-array">How to convert a 1D array into a 2D array (how to add a new axis to an array)</h2>
<ol>
<li><p><code>np.newaxis</code></p>
</li>
<li><p><code>np.expand_dims</code></p>
</li>
</ol>
<p>Using <code>np.newaxis</code> will increase the dimensions of your array by one dimension when used once. This means that a <strong>1D</strong> array will become a <strong>2D</strong> array, a <strong>2D</strong> array will become a <strong>3D</strong> array, and so on.</p>
<h2 id="heading-indexing-and-slicing">Indexing and Slicing</h2>
<pre><code class="lang-python">data = np.array([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>])

data[<span class="hljs-number">1</span>]
<span class="hljs-number">2</span>

data[<span class="hljs-number">0</span>:<span class="hljs-number">2</span>]
array([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>])

data[<span class="hljs-number">1</span>:]
array([<span class="hljs-number">2</span>, <span class="hljs-number">3</span>])

data[<span class="hljs-number">-2</span>:]
array([<span class="hljs-number">2</span>, <span class="hljs-number">3</span>])
</code></pre>
<p><img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d57804c3-18f7-46dc-aba6-ca8f9f02768c/Screenshot_2023-06-17_213228.png" alt="Screenshot 2023-06-17 213228.png" /></p>
<h2 id="heading-how-to-create-an-array-from-existing-data">How to create an array from existing data?</h2>
<ol>
<li><p>slicing</p>
</li>
<li><p>indexing</p>
</li>
<li><p><code>np.vstack()</code></p>
</li>
<li><p><code>np.hsplit()</code></p>
</li>
<li><p><code>.view()</code></p>
</li>
<li><p><code>copy()</code></p>
</li>
</ol>
<p>&lt;aside&gt; 💡 I have left it for later reading</p>
<p>&lt;/aside&gt;</p>
<h1 id="heading-basic-array-operations">Basic array operations</h1>
<ol>
<li><p>addition</p>
</li>
<li><p>subtraction</p>
</li>
<li><p>multiplication</p>
</li>
<li><p>division</p>
</li>
<li><p><code>.sum( )</code></p>
</li>
<li><p><code>b.sum(axis=0</code></p>
</li>
</ol>
<h2 id="heading-broadcasting">Broadcasting</h2>
<p>NumPy understands that the multiplication should happen with each cell. That concept is called <strong>broadcasting</strong>. Broadcasting is a mechanism that allows NumPy to perform operations on arrays of different shapes. The dimensions of your array must be compatible, for example, when the dimensions of both arrays are equal or when one of them is 1. If the dimensions are not compatible, you will get a <code>ValueError</code>.</p>
<h2 id="heading-more-array-operations">More array operations</h2>
<ol>
<li><p><code>max( )</code></p>
</li>
<li><p><code>min( )</code></p>
</li>
<li><p><code>sum( )</code></p>
</li>
<li><p><code>mean( )</code></p>
</li>
<li><p>product == <code>prod( )</code></p>
</li>
<li><p>standard deviation = = <code>std( )</code></p>
</li>
</ol>
<p>Creating matrices</p>
<p>Be aware that when NumPy prints N-dimensional arrays, the last axis is looped over the fastest while the first axis is the slowest. For instance:</p>
<p><img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/57a99102-c34f-4f49-b104-7c435fa5b8ba/Screenshot_2023-06-17_215551.png" alt="Screenshot 2023-06-17 215551.png" /></p>
<p><img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/90ac0832-8c1f-4310-801c-70c90c5536bd/Screenshot_2023-06-17_215612.png" alt="Screenshot 2023-06-17 215612.png" /></p>
<p><img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f415d8db-fe32-4d51-a2b1-1d04c08021d5/Screenshot_2023-06-17_215659.png" alt="Screenshot 2023-06-17 215659.png" /></p>
<p><img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/cbeeb031-1a91-472e-a7f4-16307290c0a6/Screenshot_2023-06-17_215817.png" alt="Screenshot 2023-06-17 215817.png" /></p>
<h2 id="heading-generating-random-numbers">Generating random numbers</h2>
<p>&lt;aside&gt; 💡 Something wrong</p>
<p>&lt;/aside&gt;</p>
<h2 id="heading-how-to-get-unique-items-and-counts">How to get unique items and counts?</h2>
<pre><code class="lang-python">unique_values = np.unique(a)
</code></pre>
<pre><code class="lang-python">print(unique_values)
[<span class="hljs-number">11</span> <span class="hljs-number">12</span> <span class="hljs-number">13</span> <span class="hljs-number">14</span> <span class="hljs-number">15</span> <span class="hljs-number">16</span> <span class="hljs-number">17</span> <span class="hljs-number">18</span> <span class="hljs-number">19</span> <span class="hljs-number">20</span>]
</code></pre>
<pre><code class="lang-python">unique_values, indices_list = np.unique(a, return_index=<span class="hljs-literal">True</span>)
</code></pre>
<pre><code class="lang-python">print(indices_list)
[ <span class="hljs-number">0</span>  <span class="hljs-number">2</span>  <span class="hljs-number">3</span>  <span class="hljs-number">4</span>  <span class="hljs-number">5</span>  <span class="hljs-number">6</span>  <span class="hljs-number">7</span> <span class="hljs-number">12</span> <span class="hljs-number">13</span> <span class="hljs-number">14</span>]
</code></pre>
<pre><code class="lang-python">unique_values, occurrence_count = np.unique(a, return_counts=<span class="hljs-literal">True</span>)
</code></pre>
<pre><code class="lang-python">print(occurrence_count)
[<span class="hljs-number">3</span> <span class="hljs-number">2</span> <span class="hljs-number">2</span> <span class="hljs-number">2</span> <span class="hljs-number">1</span> <span class="hljs-number">1</span> <span class="hljs-number">1</span> <span class="hljs-number">1</span> <span class="hljs-number">1</span> <span class="hljs-number">1</span>]
</code></pre>
<h2 id="heading-transposing-and-reshaping-a-matrix">Transposing and reshaping a matrix</h2>
<ol>
<li><p><code>arr.reshape( )</code></p>
</li>
<li><p><code>arr.transpose( )</code></p>
</li>
<li><p><code>arr.T</code></p>
<p> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/6e843d86-0f5f-4fe3-b905-cbc9a673e843/Screenshot_2023-06-17_220937.png" alt="Screenshot 2023-06-17 220937.png" /></p>
</li>
</ol>
<p><img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/40b3130d-1d71-48f8-aa66-c1df4b36d3ea/Screenshot_2023-06-17_221024.png" alt="Screenshot 2023-06-17 221024.png" /></p>
<h2 id="heading-how-to-reverse-an-array">How to reverse an array?</h2>
<ol>
<li><code>np.flip( )</code></li>
</ol>
<p>You can also reverse the contents of only one column or row. For example, you can reverse the contents of the row at index position 1 (the second row):</p>
<pre><code class="lang-python">arr_2d[<span class="hljs-number">1</span>] = np.flip(arr_2d[<span class="hljs-number">1</span>])
</code></pre>
<pre><code class="lang-python">print(arr_2d)
[[ <span class="hljs-number">1</span>  <span class="hljs-number">2</span>  <span class="hljs-number">3</span>  <span class="hljs-number">4</span>]
 [ <span class="hljs-number">8</span>  <span class="hljs-number">7</span>  <span class="hljs-number">6</span>  <span class="hljs-number">5</span>]
 [ <span class="hljs-number">9</span> <span class="hljs-number">10</span> <span class="hljs-number">11</span> <span class="hljs-number">12</span>]]
</code></pre>
<p>You can also reverse the column at index position 1 (the second column):</p>
<pre><code class="lang-plaintext">arr_2d[:,1] = np.flip(arr_2d[:,1])
</code></pre>
<pre><code class="lang-plaintext">print(arr_2d)
[[ 1 10  3  4]
 [ 8  7  6  5]
 [ 9  2 11 12]]
</code></pre>
<h2 id="heading-reshaping-and-flattening-multidimensional-arrays">Reshaping and flattening multidimensional arrays</h2>
<p>There are two popular ways to flatten an array :</p>
<ol>
<li><p><code>flatten( )</code></p>
</li>
<li><p><code>ravel( )</code></p>
</li>
</ol>
<p>The primary difference between the two is that the new array created using <code>ravel()</code> is actually a reference to the parent array (i.e., a “view”). This means that any changes to the new array will affect the parent array as well. Since <code>ravel</code> does not create a copy, it’s memory efficient.</p>
<h2 id="heading-how-to-access-the-docstring-for-more-information">How to access the docstring for more information</h2>
<ol>
<li><p><code>help( )</code></p>
</li>
<li><p><code>?</code></p>
</li>
<li><p><code>??</code></p>
</li>
</ol>
<p>When it comes to the data science ecosystem, Python and NumPy are built with the user in mind. One of the best examples of this is the built-in access to documentation. Every object contains the reference to a string, which is known as the <strong>docstring</strong>.</p>
<h2 id="heading-working-with-mathematical-formulas">Working with mathematical formulas?</h2>
<p>The ease of implementing mathematical formulas that work on arrays is one of the things that make NumPy so widely used in the scientific Python community.</p>
<p><img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/6330b0db-8b15-40fc-aa43-67749e8b9223/Screenshot_2023-06-17_223301.png" alt="Screenshot 2023-06-17 223301.png" /></p>
<p>What makes this work so well is that <code>predictions</code> and <code>labels</code> can contain one or a thousand values. They only need to be the same size.</p>
<p>We can visualize like this:</p>
<p><img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a85d2beb-82a0-4317-b311-2267c7dac2f9/Screenshot_2023-06-17_223340.png" alt="Screenshot 2023-06-17 223340.png" /></p>
<h2 id="heading-how-to-save-and-load-numpy-objects">How to save and load NumPy objects?</h2>
<ol>
<li><p><a target="_blank" href="http://np.save"><code>np.save</code></a></p>
</li>
<li><p><code>np.savez</code></p>
</li>
<li><p><code>np.savetxt</code></p>
</li>
<li><p><code>np.load</code></p>
</li>
<li><p><code>np.loadtxt</code></p>
</li>
</ol>
<p>You will, at some point, want to save your arrays to disk and load them back without having to re-run the code. Fortunately, there are several ways to save and load objects with NumPy. The ndarray objects can be saved to and loaded from the disk files with <code>loadtxt</code> and <code>savetxt</code> functions that handle normal text files, <code>load</code> and <code>save</code> functions that handle NumPy binary files with a <strong>.npy</strong> file extension, and a <code>savez</code> function that handles NumPy files with a <strong>.npz</strong> file extension.</p>
<p>If you want to store a single ndarray object, store it as a .npy file using <a target="_blank" href="http://np.save"><code>np.save</code></a>. If you want to store more than one ndarray object in a single file, save it as a .npz file using <code>np.savez</code>. You can also save several arrays into a single file in compressed npz format with <code>[savez_compressed](&lt;</code><a target="_blank" href="https://numpy.org/doc/stable/reference/generated/numpy.savez_compressed.html#numpy.savez_compressed"><code>https://numpy.org/doc/stable/reference/generated/numpy.savez_compressed.html#numpy.savez_compressed</code></a><code>&gt;)</code>.</p>
<h2 id="heading-importing-and-exporting-a-csv">Importing and exporting a CSV</h2>
<p>It’s simple to read in a CSV that contains existing information. The best and easiest way to do this is to use <a target="_blank" href="https://pandas.pydata.org/">Pandas</a>.</p>
<p><code>import pandas as pd</code></p>
<p>&lt;aside&gt; 💡 <code>a = np.array([2, 1, 5, 7, 4, 6, 8, 14, 10, 9, 18, 20, 22])</code></p>
<p>&lt;/aside&gt;</p>
<pre><code class="lang-plaintext">import matplotlib.pyplot as plt

# If you're using Jupyter Notebook, you may also want to run the following
# line of code to display your code in the notebook:

%matplotlib inline
</code></pre>
<pre><code class="lang-plaintext">plt.plot(a)
# If you are running from a command line, you may need to do this:
# &gt;&gt;&gt; plt.show()
</code></pre>
<h2 id="heading-introduction">Introduction</h2>
<p>There are 6 general mechanisms for creating arrays:</p>
<ol>
<li><p><strong>Conversion from other Python structures (i.e. lists and tuples)</strong></p>
</li>
<li><p><strong>Intrinsic NumPy array creation functions (e.g. arange, ones, zeros, etc.)</strong></p>
<ol>
<li><p><code>np.arange( )</code></p>
</li>
<li><p><code>np.linspace( )</code></p>
</li>
<li><p><code>np.eye(3) #for 2d array creation functions</code></p>
</li>
<li><p><code>np.diag( )</code></p>
</li>
<li><p><code>np.vander([1,2,3,4], 2)</code></p>
</li>
<li><p><code>np.vander((1, 2, 3, 4), 4)</code></p>
</li>
<li><p><code>np.zeros( )</code></p>
</li>
<li><p><code>np.ones( )</code></p>
</li>
<li><p>Random generator:</p>
</li>
</ol>
</li>
</ol>
<pre><code class="lang-plaintext">    from numpy.random import default_rng
</code></pre>
<pre><code class="lang-plaintext">    default_rng(42).random((2,3))
</code></pre>
<p>    j. <code>np.indices((3,3))</code></p>
<ol>
<li><p><strong>Replicating, joining, or mutating existing arrays</strong></p>
</li>
<li><p><strong>Reading arrays from disk, either from standard or custom formats</strong></p>
</li>
<li><p><strong>Creating arrays from raw bytes through the use of strings or buffers</strong></p>
</li>
<li><p><strong>Use of special library functions (e.g., random)</strong></p>
</li>
</ol>
<h1 id="heading-indexing-on-ndarrays"><strong>Indexing on</strong> <code>ndarrays</code></h1>
<p><code>[ndarrays](&lt;</code><a target="_blank" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray"><code>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray</code></a><code>&gt;)</code> can be indexed using the standard Python <code>x[obj]</code> syntax, where <em>x</em> is the array and <em>obj</em> the selection.</p>
<h1 id="heading-slicing">Slicing</h1>
<p>Basic slicing extends Python’s basic concept of slicing to N dimensions. Basic slicing occurs when <em>obj</em> is a <code>[slice](&lt;</code><a target="_blank" href="https://docs.python.org/3/library/functions.html#slice"><code>https://docs.python.org/3/library/functions.html#slice</code></a><code>&gt;)</code> object (constructed by <code>start:stop:step</code> notation inside of brackets), an integer, or a tuple of slice objects and integers. <code>[Ellipsis](&lt;</code><a target="_blank" href="https://docs.python.org/3/library/constants.html#Ellipsis&gt;"><code>https://docs.python.org/3/library/constants.html#Ellipsis&gt;)</code>and</a>and) <code>[newaxis](&lt;</code><a target="_blank" href="https://numpy.org/doc/stable/reference/constants.html#numpy.newaxis"><code>https://numpy.org/doc/stable/reference/constants.html#numpy.newaxis</code></a><code>&gt;)</code> objects can be interspersed with these as well.</p>
<p>All arrays generated by basic slicing are always <a target="_blank" href="https://numpy.org/doc/stable/glossary.html#term-view">views</a> of the original array.</p>
<p>The basic slice syntax is <code>i:j:k</code> where <em>i</em> is the starting index, <em>j</em> is the stopping index, and <em>k</em> is the step ().</p>
<p>Negative <em>i</em> and <em>j</em> are interpreted as <em>n + i</em> and <em>n + j</em> where <em>n</em> is the number of elements in the corresponding dimension. Negative <em>k</em> makes stepping go towards smaller indices.</p>
]]></content:encoded></item><item><title><![CDATA[Learning In Public]]></title><description><![CDATA["You are creating content of any form that is accessible to other people. It also includes making content public for particular communities. "
--ANAIS URLICHS (Youtube: Kunal kushwaha)

Learning in public is the practice of openly sharing your learni...]]></description><link>https://learnings.olinabin.com.np/learning-in-public</link><guid isPermaLink="true">https://learnings.olinabin.com.np/learning-in-public</guid><dc:creator><![CDATA[Nabin Oli]]></dc:creator><pubDate>Sat, 24 Jun 2023 06:45:17 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1687588900657/c5db94c2-e2aa-4736-87b9-28ecadb3481e.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<hr />
<p><strong>"You are creating content of any form that is accessible to other people. It also includes making content public for particular communities. "</strong></p>
<p><strong>--ANAIS URLICHS (Youtube: Kunal kushwaha)</strong></p>
<hr />
<p>Learning in public is the practice of openly sharing your learning journey, progress, and insights with others. It is a relatively new concept that has become increasingly popular in recent years, thanks to the rise of social media and online platforms that make it easy to share information and connect with like-minded people.</p>
<p>Learning in public is a powerful way to accelerate learning, build a brand, and create valuable connections with others. In this blog post, I will explore the benefits of learning in public:</p>
<p>Benefits of Learning in Public</p>
<ol>
<li><p>When we learn in public, we are forced to synthesize our learning and articulate it in a way that others can understand. This process of synthesis and articulation helps us to deepen our understanding of the subject matter and accelerate our learning.</p>
</li>
<li><p>Learning in public creates a sense of accountability, as we are now responsible for sharing our progress and insights with others. This accountability can help you stay motivated and on track, as we are now publicly committed to our learning journey.</p>
</li>
<li><p>When we learn in public, we open ourselves up to feedback and support from others. This feedback can help us to identify areas for improvement and provide valuable insights that we may not have otherwise considered.</p>
</li>
<li><p>Learning in public is a great way to build our brand and establish ourselves as a thought leader in an industry. By sharing our insights and knowledge with others, we can position ourselves as an expert and build a following of like-minded individuals.</p>
</li>
</ol>
<p>Getting Started with Learning in Public</p>
<ol>
<li><p>There are many platforms we can use to learn in public, including social media, blogging, podcasting, and video. We should choose the platform that we are most comfortable with and that best suits our learning style.</p>
</li>
<li><p>We should set clear goals for our learning journey and share them with our audience. This will help us stay accountable and give our audience a clear understanding of what they can expect from our content.</p>
</li>
<li><p>Share the learning process with our audience, including successes, failures, and lessons learned. This will help our audience connect with us on a deeper level and provide valuable insights that they can apply to their learning journeys.</p>
</li>
<li><p>Engage with your audience by responding to comments, asking for feedback, and creating opportunities for discussion. This will help you build a community of like-minded individuals who are interested in your content and willing to support your learning journey.</p>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[The Mystery Behind Jupyter: Unraveling the Story of its Spelling]]></title><description><![CDATA[First of all, Let's see what is Jupyter Notebook.
What is Jupyter?
Jupyter Notebook is an open-source web application that allows users to create and share documents that contain live code, equations, visualizations, and narrative text. It's commonly...]]></description><link>https://learnings.olinabin.com.np/the-mystery-behind-jupyter-unraveling-the-story-of-its-spelling</link><guid isPermaLink="true">https://learnings.olinabin.com.np/the-mystery-behind-jupyter-unraveling-the-story-of-its-spelling</guid><dc:creator><![CDATA[Nabin Oli]]></dc:creator><pubDate>Fri, 03 Feb 2023 07:34:21 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1675253299937/549f12c0-4e6c-4f82-a8da-d66ce8f8448f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>First of all, Let's see what is Jupyter Notebook.</p>
<h2 id="heading-what-is-jupyter">What is Jupyter?</h2>
<p>Jupyter Notebook is an open-source web application that allows users to create and share documents that contain live code, equations, visualizations, and narrative text. It's commonly used in data science, scientific computing, machine learning, and other technical fields to perform exploratory data analysis, write and test code, and present results.</p>
<p>I know many people may be confused due to its name why didn't the creator name it Jupiter instead of Jupyter? Why the 'y' was so important to them? Let's see;</p>
<h3 id="heading-why-the-name-is-kept-so">Why the name is kept so?</h3>
<p>As we already know that Jupyter what is Jupyter? Let's talk about why the name is kept so:</p>
<p>In beginning, Jupyter can be only used for three languages. They are; Julia, Python and R . All these three are programming languages that are widely in data science and scientific computing. By combining the names of these programming names they came up with the idea name which goes:</p>
<p><strong><mark>JU</mark></strong><mark>lia + </mark> <strong><mark>PYT</mark></strong><mark>hon + </mark> <strong><mark>R</mark></strong> <mark> = JU.PYT.e.R = Jupyter</mark></p>
<p>So this was the story behind the name of Jupyter Notebook. Now let's look at some other programming, libraries Why their name are kept so?</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Name</td><td>Reason</td></tr>
</thead>
<tbody>
<tr>
<td>Python</td><td>Inspired by Monty Python’s Flying Circus</td></tr>
<tr>
<td>NumPy</td><td>By combining these words <strong>Num</strong>erical <strong>Py</strong>thon</td></tr>
<tr>
<td>Pandas</td><td>From economic term for complex data:: Panel Data</td></tr>
<tr>
<td>Matplotlib</td><td>Name inspired by MATLAB. It is used for plotting. Since it is Library. Its name is kept by combing <strong><em>{MATlab+PLOT+LIBrary}</em></strong></td></tr>
<tr>
<td>Seaborn</td><td>associated Ocean and inspired by Sea lion. Creators thought that ocean resembles the complex data</td></tr>
<tr>
<td>C Programming Lang.</td><td>Back then there was a B programming language, so to refer to the new language creators named It C language</td></tr>
<tr>
<td>C++ Programming Lang.</td><td>The name C++ suggests “C incremented” (recall the ++ is an increment operator of C). The increment may refer to the addition of Object-oriented programming</td></tr>
<tr>
<td>FORTRAN</td><td><strong>FOR</strong>mula <strong>TRAN</strong>slation</td></tr>
</tbody>
</table>
</div>]]></content:encoded></item><item><title><![CDATA[Exploring the Basics of Computer(Part-01) : How 0's and 1's Power the Digital World]]></title><description><![CDATA[In this contemporary world, Everyone is literate about the fact that computers only understand 0 and 1. Whenever someone asks us about how a computer runs? they simply say it runs by using a 0 and 1 ... binary system... blah blah and our response to ...]]></description><link>https://learnings.olinabin.com.np/exploring-the-basics-of-computerpart-01-how-0s-and-1s-power-the-digital-world</link><guid isPermaLink="true">https://learnings.olinabin.com.np/exploring-the-basics-of-computerpart-01-how-0s-and-1s-power-the-digital-world</guid><category><![CDATA[#computer #programming, #0's and #1's, #digitaltechnology, #computer #systems, #binary #code, #computer #science, #understanding #computer #programming, #computer #programming basics, computer technology, computer science basics.]]></category><dc:creator><![CDATA[Nabin Oli]]></dc:creator><pubDate>Sat, 28 Jan 2023 18:00:20 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674977107524/d6c914ae-6016-45b0-a45a-564a78f2374b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this contemporary world, Everyone is literate about the fact that computers only understand 0 and 1. Whenever someone asks us about how a computer runs? they simply say it runs by using a 0 and 1 ... binary system... blah blah and our response to their most curious question ends without any justifying answer. Isn't that sad, cruel, despotic and evil? Sorry just kidding hehe. But in this blog, I have found all answers to your question mark. Let's get started and deep dive into it from the very beginning.</p>
<p>We all know that In Mathematics there are 0,1,2,3,4,5,6,7,8,9 and numbers keep repeating in certain sequences and order like 100, 1000, 98,87 and so on. But have you ever wondered why computers only understand 0s and 1s out of so many numbers? more specifically computer uses a binary system so the main question is Why does a binary system uses 0 and 1?</p>
<p>Let me take you to the basics and most fundamental parts of computers. The most fundamental thing needed for computers to run is electricity. Whenever the electricity flows through the wire, the behaviour shown by the electricity is ON or else OFF. In simple words, the flow of electricity is ON else it is OFF. So, we have only two activities shown by electricity. These two activities by convention are denoted as 0(zero) and 1(one) for OFF and ON respectively. It is a simple and efficient way to represent information using the two basic states of an electronic circuit, which is the foundation of all digital technology today.</p>
<p>In an electronic circuit, the flow of electricity can be either on or off, which can be represented by a 1 or a 0, respectively, right. By using only two states, a binary system can represent any type of information using a combination of 0s and 1s, also known as "bits". This makes it easy for computers to store and process large amounts of information in a relatively small space, and it can be done very quickly and efficiently. By the way, Bit is a different topic let's leave it for another day.</p>
<p>Coming back to the topic, the binary system is easy to understand and implement, which makes it a popular choice for digital systems. It also allows for easy error detection and correction, as well as easy data compression in comparison to other numbers(Visualize back in those days finding bug in black&amp;white tv searching for 0 and 1 hehe).</p>
<p>To conclude the answer given above, the binary system uses 0 and 1 because it is a simple and efficient way to represent information using the two basic states of an electronic circuit and it allows for easy error detection, correction and data compression.</p>
<h2 id="heading-now-we-are-clear-about-why-0-and-1-but-now-we-will-be-knowing-how-0-and-1-work">Now we are clear about why 0 and 1? but now we will be knowing How 0 and 1 work?</h2>
<p>So, now we got the answer of why only 0 and 1. But still, we don’t know what to do with that 0 and 1. Let me tell you the inner processes that happen unnoticed but first, I need to tell you about ASCII <strong>(American Standard Code for Information Interchange)</strong>. Don’t bother about what this complex name is.</p>
<p>Just remember that there is something called “ASCII”</p>
<h1 id="heading-ascii">ASCII</h1>
<p>ASCII stands for <strong>American Standard Code for Information Interchange</strong>. It is a code that assigns a unique number (or code) to each character, such as letters, numbers, and symbols, that are used in text-based communications. This makes it easy for computers to store, process and transmit text data.</p>
<p>For example, the letter "A" is assigned code 65, the letter "B" is assigned code 66, and so on. This way, when a computer receives code 65, it knows to display the letter "A" on the screen. ASCII code allows the computer to understand and display text in a way that humans can read.</p>
<p>ASCII is a very old standard, it has been used for decades, and it contains only 128 characters, which includes capital letters, small letters, digits, punctuation marks and some control characters like new lines, tabs etc.</p>
<p>In simple words, ASCII is a way for computers to understand and display text, by assigning a unique number to each character.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1674925473143/adf4d803-d2ba-4776-8918-51e0879c7e30.png" alt class="image--center mx-auto" /></p>
<p>ASCII (American Standard Code for Information Interchange) is used because it is a standard way to represent characters, such as letters, numbers, and symbols, in a digital format. It assigns a unique number (code) to each character, making it easy for computers to store and manipulate text data. ASCII is widely supported and is still commonly used today, especially in systems and applications that rely on plain text data.</p>
<h2 id="heading-twist"><strong><em>twist</em></strong></h2>
<p>Let me tell you something, ASCII is an old-school chart, it is now completely replaced by Unicode**.** As you know, ASCII has only 256 characters whereas Unicode has more than a billion characters due to which nowadays smartphones have so many characters, emojis, GIFs, sound-emoji and unused characters in our smartphones. So this is the inner operations that I was saying before talking about ASCII</p>
<h1 id="heading-unicode">Unicode</h1>
<p>Unicode is a universal character encoding standard that assigns unique numbers, called code points, to every character, symbol, and emoji used in all languages and scripts of the world. It was developed to address the limitations of older character encoding standards, such as ASCII, which could only represent a small number of characters.</p>
<p>Unlike ASCII, which can only represent 128 characters, Unicode can represent over a hundred thousand different characters and symbols. This includes not only the letters and numbers of various scripts (e.g. Latin, Greek, Chinese, Arabic, etc.), but also mathematical symbols, emoji, and even historical scripts.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1674926052395/f5414314-e7bc-468d-8bc9-3dd18db5664e.webp" alt class="image--center mx-auto" /></p>
<p>Unicode is designed to be compatible with ASCII, so many of the characters in the ASCII character are set to have the same code point in Unicode. However, Unicode also includes many additional characters and symbols that are not found in ASCII.</p>
<p>Unicode is widely used in computer systems and applications, including operating systems, web browsers, and programming languages, to ensure that text is displayed correctly and consistently across different languages and platforms.</p>
<p>In simple terms, Unicode is a way for computers to understand and display text in any language or script, by assigning a unique number to each character</p>
<h3 id="heading-remember-our-question-is-still-unanswered">Remember our question is still unanswered :)</h3>
<p>If I want to write <code>HI</code> message to my crush. Let's see the Unicode table above:</p>
<p>Using a Unicode code table is a little harder than ASCII</p>
<p>You can see:</p>
<ul>
<li><p><code>H</code> lies at 72</p>
</li>
<li><p><code>I</code> lie at 73</p>
<p>  So, now you can visualize that whenever I send my crush a message of <code>HI</code> it will send decimals i.e. 72 and 73 numbers by converting them into 0s and 1s which are 01001000 01001001</p>
</li>
</ul>
<h3 id="heading-closing-notes">Closing notes :)</h3>
<p>We've just scratched the surface of what ASCII and Unicode are and how they work. In this blog post, we've covered the basics of these character encoding standards and why they're important for digital communications. But there's still so much more to learn about these topics, such as how a programming language works and how software is made using that language.</p>
<p>I'll be diving deeper into these topics in upcoming blog posts, so stay tuned! In the meantime, if you have any questions or comments about this post, please don't hesitate to reach out. Thanks for reading! :)</p>
]]></content:encoded></item><item><title><![CDATA[LEAP YEAR Question- A story behind use of 4, 100 and 400]]></title><description><![CDATA[Two months back I was solving the assignment sets that were assigned to me in class and I was solving the question of leap year. As I always do I broke down the problem into pieces and divided it into three parts;
First: Write some code to take input...]]></description><link>https://learnings.olinabin.com.np/leap-year-question-a-story-behind-use-of-4-100-and-400</link><guid isPermaLink="true">https://learnings.olinabin.com.np/leap-year-question-a-story-behind-use-of-4-100-and-400</guid><dc:creator><![CDATA[Nabin Oli]]></dc:creator><pubDate>Tue, 24 Jan 2023 12:12:53 GMT</pubDate><content:encoded><![CDATA[<p>Two months back I was solving the assignment sets that were assigned to me in class and I was solving the question of leap year. As I always do I broke down the problem into pieces and divided it into three parts;</p>
<p>First: Write some code to take input year</p>
<p>Second: Find what exactly is leap year.</p>
<p>third: Write the code to find the leap from the input year.</p>
<p>Fourth: Just End</p>
<p>I found out that leap year is the year which is repeated every four years. It is done to compensate for the extra days that is 365_1/4 days. I thought I got it but I was wrong</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1674558809780/15e454ff-79f6-435d-a90c-cca52ea31772.png" alt class="image--center mx-auto" /></p>
<p>Can you see there are extra test cases of division by 100 and another division by 400? I was like; I understand the presence of division by 4 but why there is division by 100 and again by 400? That put me into deep thinking.</p>
<p>If you still here reading this blog lets deep into the history of calendars;</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>BC (Before Christ)</td><td></td></tr>
</thead>
<tbody>
<tr>
<td>Started on</td><td>100 BC</td></tr>
<tr>
<td>Ended on</td><td>1 BC</td></tr>
<tr>
<td></td><td>THERE IS NO PRESENCE OF 0 AD OR 0 BC</td></tr>
<tr>
<td><strong>AD (Anno Domini)</strong></td><td></td></tr>
<tr>
<td>Started on</td><td>1 AD</td></tr>
<tr>
<td>ongoing</td><td>2023 AD</td></tr>
</tbody>
</table>
</div><p>Let's dive into the AD calendar:</p>
<p>So till we came to know How the calendar is established or made. As a fun fact, I will like to share that Nepal has a different calendar the year now is 2079 BS. That means Nepalese people are living just 57 years ahead of the English calendar. although the development and its infrastructure are no futuristics the beauty of nature is more than 57 years valuable.</p>
<p>Let's come back to the topic;</p>
<p>since the beginning of 1 AD people had different calendar views there was some social issue(related to religious biases) also. So that resulted in different views towards the calendar and started to formulate new ideas for the calendar.</p>
<p>We use numbers 4, 100, and 400 to calculate a program to find out leap years because they are used to determine the rules for a leap year according to the Gregorian calendar.</p>
<ul>
<li><p>A year is a leap year if it is divisible by 4. This is because the Earth's orbit around the sun takes approximately 365.25 days, so every four years an extra day (February 29th) is added to the calendar to keep the calendar in sync with the orbit.</p>
</li>
<li><p>However, there is an exception to this rule. Years that are divisible by 100 are not leap years, but years that are divisible by 400 are leap years. This is because the orbit of the Earth is not exactly 365.25 days, but slightly less. Adding an extra day every four years would cause the calendar to drift too far from the actual orbit, so the rule was adjusted to exclude years that are divisible by 100 but include years that are divisible by 400.</p>
</li>
</ul>
<p>So, we use 4, 100 and 400 to find out the leap year because these numbers are used to determine leap years as per the rules of the Gregorian calendar.</p>
<p>Yeah this is it for the question if you want to know little more detail about second bullets follow this quoar link;</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://qr.ae/pro8I2">https://qr.ae/pro8I2</a></div>
]]></content:encoded></item></channel></rss>