<?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: Elkanah Malonza</title>
    <description>The latest articles on DEV Community by Elkanah Malonza (@malonzaelkanah).</description>
    <link>https://dev.to/malonzaelkanah</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%2F811586%2Fdfd0848e-388c-41b8-bd49-45c1573ff688.jpeg</url>
      <title>DEV Community: Elkanah Malonza</title>
      <link>https://dev.to/malonzaelkanah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/malonzaelkanah"/>
    <language>en</language>
    <item>
      <title>A Beginners Guide to Contributing to an Existing Git Repository</title>
      <dc:creator>Elkanah Malonza</dc:creator>
      <pubDate>Mon, 17 Oct 2022 11:18:51 +0000</pubDate>
      <link>https://dev.to/malonzaelkanah/a-beginners-guide-to-contributing-to-an-existing-git-repository-jln</link>
      <guid>https://dev.to/malonzaelkanah/a-beginners-guide-to-contributing-to-an-existing-git-repository-jln</guid>
      <description>&lt;p&gt;A Git repository helps an individual and organizations to store a collection of files of various different versions of a Project. These files are usually imported from the repository into the local server of the user for update and modifications. Git is also used for coordinating work among programmers collaboratively developing source code during software development.&lt;/p&gt;

&lt;p&gt;As an inexperienced newcomer, new to an organization, working with git command can be very overwhelming. This article is a guide to help a newbie make their first contribution in an existing organization Git repository. It can also be used by an expert as a reference guide.  Let's get into it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Git installed in your computer&lt;/li&gt;
&lt;li&gt;GitHub account or any other software repository&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; For the purpose of this blog we will be working with this repository: &lt;a href="https://github.com/MalonzaElkanah/To-Do-Flask"&gt;https://github.com/MalonzaElkanah/To-Do-Flask&lt;/a&gt; on a Linux distro PC.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Initialize the project folder
&lt;/h2&gt;

&lt;p&gt;The first step is to create a folder for the project and give it the same name as the project. For example, I will open the terminal and create a folder called &lt;em&gt;‘to-do app’&lt;/em&gt;. I use the command &lt;em&gt;‘&lt;strong&gt;mkdir&lt;/strong&gt;’&lt;/em&gt; to create a folder in Ubuntu OS. After creating the folder, use the &lt;em&gt;‘&lt;strong&gt;cd&lt;/strong&gt;’&lt;/em&gt; command to navigate into the folder.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--arJheDwa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pkusy738dschuqy0k5av.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--arJheDwa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pkusy738dschuqy0k5av.png" alt="Terminal screen of mkdir and cd commands" width="875" height="247"&gt;&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;We need to turn the new folder to a local repository for the project. Using the ‘&lt;code&gt;git init&lt;/code&gt;’ command, we will create an empty Git repository. This command will create a .git directory with sub-directories for objects , refs/heads , refs/tags , and template files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wDmxGPC---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8g58t80sm1bdpqv3ulep.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wDmxGPC---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8g58t80sm1bdpqv3ulep.png" alt="git init terminal screen" width="880" height="247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Connect the local repo to the remote repo
&lt;/h2&gt;

&lt;p&gt;So far your local repository is not linked to the remote project repository. To connect to the project remote repository, use the ‘&lt;code&gt;git remote add&lt;/code&gt;’ command on the terminal of your local repository. The git remote add command takes two arguments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;remote name&lt;/strong&gt;, for example, origin
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;remote URL&lt;/strong&gt;, for example, &lt;a href="https://github.com/user/repo.git"&gt;https://github.com/user/repo.git&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The easiest way to get the remote-url is to add ‘&lt;em&gt;.git&lt;/em&gt;’ to the remote repository link, For Example: [&lt;a href="https://github.com/MalonzaElkanah/To-Do-Flask"&gt;https://github.com/MalonzaElkanah/To-Do-Flask&lt;/a&gt;] repo, add ‘.git’ at the end to create the remote url, [&lt;a href="https://github.com/MalonzaElkanah/To-Do-Flask.git"&gt;https://github.com/MalonzaElkanah/To-Do-Flask.git&lt;/a&gt; ]. &lt;br&gt;
You can also get the remote-url from the repo page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0TuDDXKb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ji3ijckbd5cwwbtjfxcr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0TuDDXKb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ji3ijckbd5cwwbtjfxcr.png" alt="github repository page" width="880" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After using the ‘&lt;code&gt;git remote add&lt;/code&gt;’ command, use the ‘&lt;code&gt;git remote -v&lt;/code&gt;’ command to verify the remote repo connection:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1lTOPZnS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jc4l1l3se8p0caimzpdz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1lTOPZnS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jc4l1l3se8p0caimzpdz.png" alt="git remote terminal screen" width="880" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Get the files from remote repo
&lt;/h2&gt;

&lt;p&gt;We need to download the remote repository files in order to start making contributions. The ‘&lt;code&gt;git fetch --all&lt;/code&gt;’ command is a primary command used to download all contents from a remote repository. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9Qv90BCC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/farj2cca15oul7xg5c7y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9Qv90BCC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/farj2cca15oul7xg5c7y.png" alt="git fetch --all command terminal window" width="880" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The files have been downloaded to the local repository and stored in the .git folder. The files are not available in our project folder because we have not selected any remote branch. Assuming the remote repository you will be working in contains a couple of branches, you can switch between these branches using ‘&lt;code&gt;git checkout&lt;/code&gt;’ command. &lt;br&gt;
For instance, currently the to-do app has one branch, ’main’ branch, so the command to switch to that branch will be: &lt;code&gt;git checkout main&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--goURWSMz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jdnuu53iy6t1jauhv9cx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--goURWSMz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jdnuu53iy6t1jauhv9cx.png" alt="git checkout main terminal window" width="880" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now all the files that belong to the main branch are available in your local project folder.&lt;br&gt;
To find out what branches are available in your local repository and what the current branch name is, execute ‘&lt;code&gt;git branch&lt;/code&gt;’ command.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Updating Remote repo from local repo changes
&lt;/h2&gt;

&lt;p&gt;If you have made modifications to the content of the project file and/or added new files to the project folder, you can update the changes to the remote repository. To view the modified files use the ‘&lt;code&gt;git status&lt;/code&gt;’ command. For example, I have modified the &lt;em&gt;README.md&lt;/em&gt; file and added &lt;em&gt;requirements.txt&lt;/em&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0kepwu0L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1okmnk4vc7lhdywkxym8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0kepwu0L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1okmnk4vc7lhdywkxym8.png" alt="git status terminal window" width="880" height="247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To push the changes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use the ‘&lt;code&gt;git add .&lt;/code&gt;’ command to make all new files(in this case, &lt;em&gt;requirements.txt&lt;/em&gt;) to be tracked by git. To add a specific file/folder use ‘&lt;code&gt;git add &amp;lt;file/folder-name&amp;gt;&lt;/code&gt;’, for instance, in our example we will use: &lt;code&gt;git add requirements.txt&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then, use the ‘&lt;code&gt;git commit&lt;/code&gt;’ to 'stage' changes to the project that will be stored in a commit. That is, the command captures a snapshot of the project's currently staged changes. The command has several option&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;-a option&lt;/strong&gt; for committing a snapshot of all changes in the working directory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;-m option&lt;/strong&gt; for passing a commit message.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;--amend option&lt;/strong&gt; for modifying the last commit. Instead of creating a new commit, staged changes will be added to the previous commit.
For instance, the commit statement for our to-do app will be: 
&lt;code&gt;git commit -a -m "Added Project requirements, updated README.md"&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;‘&lt;code&gt;git push&lt;/code&gt;’ command will upload local repository content to a remote repository. It will transfer all commits from your local repository to a remote repository. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For instance, to push our to-do app local changes:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WCq8OdLx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fwq90dubukmm4lmgo3oe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WCq8OdLx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fwq90dubukmm4lmgo3oe.png" alt="git add, commit and push terminal window" width="880" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: update the local repo to match remote repo content
&lt;/h2&gt;

&lt;p&gt;When different people are working on the same project or you are working on the same project from multiple PCs, sometimes the remote repository is ahead in terms of commits in comparison to local repository. &lt;br&gt;
The ‘&lt;code&gt;git pull&lt;/code&gt;’ command is used to fetch and download content from a remote repository and immediately update the local repository to match that content.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--52eHqkjL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oj2ddzhvrgokzshk5bmq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--52eHqkjL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oj2ddzhvrgokzshk5bmq.png" alt="git pull terminal window" width="880" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Creating remote branches
&lt;/h2&gt;

&lt;p&gt;In a Collaboration project, programmers don’t usually work on the main branch. When a programmer wants to add a new feature or fix a bug, no matter how big or how small, they spawn a new branch to encapsulate the changes. When the features are complete or bugs fixed they merge the branch to the main.  &lt;/p&gt;

&lt;p&gt;In order to create a new branch locally, use the ‘&lt;code&gt;git checkout -b&lt;/code&gt;’ command. To create a branch from another branch using git checkout, use the following syntax: &lt;code&gt;git checkout -b &amp;lt;new_branch&amp;gt; &amp;lt;old_branch&amp;gt;&lt;/code&gt;&lt;br&gt;
In our project I will create a ‘&lt;em&gt;sqlalchemy_orm&lt;/em&gt;’ branch from the &lt;em&gt;main&lt;/em&gt; branch.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xvLStyV8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3xuw7ab7l9natnu46gq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xvLStyV8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3xuw7ab7l9natnu46gq.png" alt="git checkout -b terminal window" width="880" height="247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For now the new branch only exists in the local repository. To update the remote repository about the new branch, use the ‘&lt;code&gt;git push –set-upstream origin &amp;lt;new_branch&amp;gt;&lt;/code&gt;’ command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4yas10mh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/symxmrsr07uf06dbpi54.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4yas10mh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/symxmrsr07uf06dbpi54.png" alt="git push –set-upstream origin terminal window" width="880" height="247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every change you commit will be pushed to the new branch unless you merge the branch with another or you switch to another branch.&lt;/p&gt;

&lt;h2&gt;
  
  
  End Note
&lt;/h2&gt;

&lt;p&gt;The objective of this article was to give step by step instruction to contribute to an existing repository for a beginner. There are other git commands not mentioned above that were irrelevant to the guide but are as much important. It's wise to know at least what they do just in case you get any conflict when working with above git commands. &lt;/p&gt;

&lt;p&gt;HAPPY CODING! &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>git</category>
      <category>github</category>
    </item>
    <item>
      <title>The Ultimate Guide to Getting Started in Data Science</title>
      <dc:creator>Elkanah Malonza</dc:creator>
      <pubDate>Sat, 02 Apr 2022 20:07:28 +0000</pubDate>
      <link>https://dev.to/malonzaelkanah/the-ultimate-guide-to-getting-started-in-data-science-1edh</link>
      <guid>https://dev.to/malonzaelkanah/the-ultimate-guide-to-getting-started-in-data-science-1edh</guid>
      <description>&lt;p&gt;Data science generally refers to the process of working out insights from large datasets of unstructured data. This means using predicative analytics, statistics and machine learning to wade through the mass of data.&lt;/p&gt;

&lt;p&gt;The practice of data science, may seem to have started in the last decade, but it has been with us for a while longer. Data science began in statistics. In recent years, its popularity has grown considerably due to innovations in data collection, technology, and mass production of data worldwide. Part of the evolution of data science from statistics is the inclusion of concepts such as machine learning and artificial intelligence. &lt;/p&gt;

&lt;p&gt;In this article, we’ll share a concise summary of the concepts of which a beginner needs to get started in data science. Let me highlight them before we get started:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Data Scientist Role and Responsibilities&lt;/li&gt;
&lt;li&gt;Python for Data Science&lt;/li&gt;
&lt;li&gt;Data Visualization&lt;/li&gt;
&lt;li&gt;SQL for Data Science&lt;/li&gt;
&lt;li&gt;Statistics for Data Science&lt;/li&gt;
&lt;li&gt;Data Exploration&lt;/li&gt;
&lt;li&gt;Machine Learning for Data Science&lt;/li&gt;
&lt;li&gt;Model Deployment &lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Data Scientist Role and Responsibilities
&lt;/h2&gt;

&lt;p&gt;For you to be a data scientist you must first definitely know the roles and responsibilities of data scientists. How they design data modeling processes, create algorithms and predictive models to extract the data the business needs, and help analyze the data and share insights with peers. You must know the process for gathering and analyzing data, For Instance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Capture the data&lt;/li&gt;
&lt;li&gt;Process the data&lt;/li&gt;
&lt;li&gt;Analyze the data&lt;/li&gt;
&lt;li&gt;Communicate the results&lt;/li&gt;
&lt;li&gt;Maintain the data&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Python for Data Science
&lt;/h2&gt;

&lt;p&gt;Python is a programming language that is easy to learn. Its syntax is easy and code is very readable. Python has a lot of applications. It's used for developing web applications, data science, rapid application development, and so on. Python allows you to write programs in fewer lines of code than most of the programming languages thus its popularity grew rapidly in Data Science.&lt;/p&gt;

&lt;p&gt;Python also has tools and processes used by data scientists to format, process, and query their data. They include:         &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pandas&lt;/strong&gt; - Pandas provides fast, flexible, and expressive data structures to make working with relational or labeled data more intuitive. It performs well with tabular type of data (such as SQL tables or Excel spreadsheets) and is really good with time-series data (like, say, temperatures taken on a hourly basis).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NumPy&lt;/strong&gt; - NumPy adds big data-manipulation tools to Python such as large-array manipulation and high-level mathematical functions for data science. NumPy is best at handling basic numerical computation such as means, averages, and so on. It also excels at the creation and manipulation of multidimensional arrays known as &lt;strong&gt;tensors&lt;/strong&gt; or &lt;strong&gt;matrices&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Matplotlib&lt;/strong&gt; - It provides a Python object-oriented API for embedded plots into applications using general-purpose GUI interfaces. You can make elaborate and professional-looking graphs, and even build “live” graphs that update while your application is running.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Seaborn&lt;/strong&gt; -  Seaborn is a python graphic library built on top of matplotlib. It allows to make your charts prettier with less code. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regular Expressions&lt;/strong&gt; - Regular expressions are huge time-savers for programmers. They allow you to specify a pattern of text to search for or filter. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Data Visualization
&lt;/h2&gt;

&lt;p&gt;Data visualization is the representation of data through use of common graphics, such as charts, plots, info-graphics, and even animations. These visual displays of information communicate complex data relationships and data-driven insights in a way that is easy to understand.&lt;br&gt;
Their are different Data Visualization Tools in data science. We have already explored data visualization python tools such as &lt;code&gt;Matplotlib&lt;/code&gt; and &lt;code&gt;Seaborn&lt;/code&gt; in above section. Their are other data visualization tools that do not require coding, for instance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tableau&lt;/strong&gt; (&lt;a href="https://www.tableau.com/"&gt;https://www.tableau.com/&lt;/a&gt;) - Based on Dashboards which act as a data visualization tool where users can easily analyze trends and statistics. It can be a powerful way of communicating results of a Data Science project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infogram&lt;/strong&gt; (&lt;a href="https://infogram.com/app/"&gt;https://infogram.com/app/&lt;/a&gt;) - Web-based visualization environment; infographic environment. Multiple PDF/PNG or HTML-based templates;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flourish&lt;/strong&gt; (&lt;a href="https://flourish.studio/examples/"&gt;https://flourish.studio/examples/&lt;/a&gt;) - Another web-based visualization environment. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Datawrapper&lt;/strong&gt; (&lt;a href="https://www.datawrapper.de/"&gt;https://www.datawrapper.de/&lt;/a&gt;) - Web-based visualization and map creation environment. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. SQL for Data Science
&lt;/h2&gt;

&lt;p&gt;SQL (Structured Query Language) is a database computer language designed for managing data in relational database.  A database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. There are lots of different database systems, for instance: MySQL, Oracle Database, Microsoft SQL Server, IBM DB2, Sybase, PostgreSQL, etc.&lt;br&gt;&lt;br&gt;
In Data Science, SQL  is used for performing various operations on the data stored in the databases like updating records, deleting records, creating and modifying tables, views, etc. SQL is also the standard for the current big data platforms that use SQL as their key API for their relational databases.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Statistics for Data Science
&lt;/h2&gt;

&lt;p&gt;Having Statistics knowledge in data science will make it easy for you to make insight in data. Statistics provides you with the tools and methods to perform data analysis. Its important to learn the following statistics concepts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mean, Variance, Standard Deviation&lt;/li&gt;
&lt;li&gt;Random variables&lt;/li&gt;
&lt;li&gt;Probability Theory&lt;/li&gt;
&lt;li&gt;Descriptive Statistics&lt;/li&gt;
&lt;li&gt;Bayes Theorem&lt;/li&gt;
&lt;li&gt;Linear Regression &lt;/li&gt;
&lt;li&gt;Gauss-Markov Theorem&lt;/li&gt;
&lt;li&gt;Over- and Under-Sampling&lt;/li&gt;
&lt;li&gt;Confidence intervals&lt;/li&gt;
&lt;li&gt;Statistical significance &lt;/li&gt;
&lt;li&gt;Inferential Statistics &lt;/li&gt;
&lt;li&gt;Central Limit Theorem &amp;amp; Law of Large Numbers&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. Data Exploration
&lt;/h2&gt;

&lt;p&gt;Data exploration is the initial step in data analysis, where users explore a large data set in an unstructured way to uncover initial patterns, characteristics, and points of interest. Exploration Data analysis(EDA) is important because it helps in: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spotting mistakes and missing data. &lt;/li&gt;
&lt;li&gt;Checking of assumptions.&lt;/li&gt;
&lt;li&gt;Selection of appropriate models. &lt;/li&gt;
&lt;li&gt;Mapping out the underlying structure of the data.
&lt;/li&gt;
&lt;li&gt;Identifying the important variables and their relations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;People are not very good at looking at a column of numbers or a whole spread-sheet and then determining important characteristics of the data. Exploratory data analysis techniques have been devised as an aid in this situation. &lt;/p&gt;

&lt;p&gt;Exploratory data analysis involves use of non-graphical or graphical Methods. Non-graphical methods generally involve calculation of summary statistics(Statistics concepts mentioned above), while graphical methods obviously summarize the data in a diagrammatic way(Visualization concepts mentioned above). &lt;/p&gt;

&lt;h2&gt;
  
  
  7. Machine Learning for Data Science
&lt;/h2&gt;

&lt;p&gt;Machine Learning(ML) is a branch in  artificial intelligence where a set of Algorithms, gives a Computers the ability to learn from data on their own without any human intervention. Computers learn, grow, adapt, and develop by themselves when they are fed with relevant data, without relying on explicit programming. Without data, there is very little that Machines can learn. Example of a ML System is YouTube and Netflix Video Recommendation. &lt;/p&gt;

&lt;p&gt;In Data Science, Machine Learning is used for the analysis of data and extraction of useful information from it. Machine Learning basically automates the process of Data Analysis and makes data-informed predictions in real-time without any human intervention.&lt;br&gt;
Learning how to build ML models in data science is important. You should know and implement the following ML Concepts:     &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pipeline&lt;/li&gt;
&lt;li&gt;Linear Regression, Perceptron, and Neural Networks&lt;/li&gt;
&lt;li&gt;Logistic Regression&lt;/li&gt;
&lt;li&gt;Decision Tree&lt;/li&gt;
&lt;li&gt;Naive Bayes&lt;/li&gt;
&lt;li&gt;Support Vector Machines(SVM)&lt;/li&gt;
&lt;li&gt;Ensemble Learning&lt;/li&gt;
&lt;li&gt;Random Forest&lt;/li&gt;
&lt;li&gt;Boosting Algorithms&lt;/li&gt;
&lt;li&gt;Advanced Ensemble Learning&lt;/li&gt;
&lt;li&gt;Hyper-parameter Tuning&lt;/li&gt;
&lt;li&gt;Unsupervised Machine Learning&lt;/li&gt;
&lt;li&gt;K - Means Clustering&lt;/li&gt;
&lt;li&gt;Hierarchical Clustering&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  8. Model Deployment
&lt;/h2&gt;

&lt;p&gt;For your data science and machine learning project to be available to other users, you need to deploy it. Their are a couple of technologies required to accomplish this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Streamlit&lt;/strong&gt; - This is an open-source python framework for building web apps for Machine Learning and Data Science. You can instantly develop web apps and deploy them using streamlit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Web Services&lt;/strong&gt; (AWS) - This cloud computing platform that where you can deploy your data science model. AWS services can offer tools such as compute power, database storage and content delivery services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flask&lt;/strong&gt; - This is a web application framework written in Python. It has multiple modules that make it easier for a web developer to write applications. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FastAPI&lt;/strong&gt; - FastAPI is a modern, fast, high-performance, web framework for building APIs with Python. If you want share your data science model as a REST interface, this is the right tool for you.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  END NOTE
&lt;/h2&gt;

&lt;p&gt;Data science is the process of asking interesting questions, and then answering those questions using data. Being comfortable with above skills will help you to solve data science problems. &lt;/p&gt;

&lt;p&gt;To begin your career in data science, at least be comfortable with python programming language, be able perform data analysis, manipulation, and visualization with pandas and learn machine learning fundamentals.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>python</category>
      <category>database</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Python for everyone: Mastering Python The Right Way</title>
      <dc:creator>Elkanah Malonza</dc:creator>
      <pubDate>Fri, 04 Mar 2022 10:59:09 +0000</pubDate>
      <link>https://dev.to/malonzaelkanah/python-for-everyone-mastering-python-the-right-way-6pb</link>
      <guid>https://dev.to/malonzaelkanah/python-for-everyone-mastering-python-the-right-way-6pb</guid>
      <description>&lt;p&gt;In the recent years Python has become one of the most popular programming language. This has not happened by accident, but mainly because: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Its easy to learn and use&lt;/strong&gt; - Python has an English-like syntax, making it easier to read and understand the code. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Python is free&lt;/strong&gt; - Python comes under the OSI approved open-source license. This makes it free to use and distribute. Who doesn't like free stuff? &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improves Productivity&lt;/strong&gt; - We have mentioned that Python is a very simple language. Its simplicity make Developers to focus on solving the problem thus spending less time understanding the syntax or behavior of the programming language, improving productivity.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Libraries Support&lt;/strong&gt; - due to its vast application, Python standard library is huge, you can find almost all the functions needed for your task. And if you don't find, Python external libraries has over 200,000+ packages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;its portable&lt;/strong&gt; - You can run Python program in different platform(even your smartphone) without changing a single line of code to adjust to platform dependency issues. You only write once and run it anywhere.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After analyzing the above pros I can comfortably say Python is for Everyone. It is a great choice for beginners up to professionals. You still don't believe me!! Okay, lets check at the areas you can apply python programming language:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Big Data and data science,&lt;/li&gt;
&lt;li&gt;artificial intelligence, machine learning and neural networks, &lt;/li&gt;
&lt;li&gt;physical computing (Raspberry Pi computer) and Embedded Applications&lt;/li&gt;
&lt;li&gt;Web Development&lt;/li&gt;
&lt;li&gt;Scripts and Automation&lt;/li&gt;
&lt;li&gt;Game Development&lt;/li&gt;
&lt;li&gt;Desktop GUI&lt;/li&gt;
&lt;li&gt;Web Scraping Applications&lt;/li&gt;
&lt;li&gt;Business Applications&lt;/li&gt;
&lt;li&gt;Audio and Video Applications&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The objective of this article is not to sell Python, the language practically sells itself, but to guide you on the core concepts you need to master before you can officially call yourself a Python GURU. Mastering this concepts will make it easier for you to venture in above Python application fields.The concepts are basics and intermediate, easy stuff.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;basic concepts&lt;/strong&gt; that we will discuss are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Data types - Numbers, Strings, Boolean, &lt;/li&gt;
&lt;li&gt;Python Operators - Arithmetic Operators, Comparison Operators, Boolean Operators&lt;/li&gt;
&lt;li&gt;Variables and Keywords&lt;/li&gt;
&lt;li&gt;Flow Control Statements - if statements, while loops, for loops&lt;/li&gt;
&lt;li&gt;Function - Inbuilt Functions, defining a function, arguments, anonymous functions,
&lt;/li&gt;
&lt;li&gt;Python Data Types - Lists, Tuples, Sets, Dictionaries&lt;/li&gt;
&lt;li&gt;Classes and Objects, Inheritance, &lt;/li&gt;
&lt;li&gt;Handling the error and exceptions - try.. except.. else.. finally..&lt;/li&gt;
&lt;li&gt;importing libraries&lt;/li&gt;
&lt;li&gt;String in-depth&lt;/li&gt;
&lt;li&gt;Number in-depth&lt;/li&gt;
&lt;li&gt;Date and Time&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;strong&gt;intermediate-level&lt;/strong&gt; concepts that we will discuss are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Regular Expressions (regexes)&lt;/li&gt;
&lt;li&gt;File Operations&lt;/li&gt;
&lt;li&gt;Making your own module/library&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1.1 Data types
&lt;/h2&gt;

&lt;p&gt;You need to master data types. This are category for values. In Python every value belongs to exactly one data type. You need to learn how to declare them. Most common data type in python are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;String&lt;/strong&gt; - This is a text values. Always surround your string in quotes. For Example:&lt;br&gt;
&lt;code&gt;'Hello, I am learning Python'&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Integer&lt;/strong&gt; - This is any whole number, positive or negative. For Example:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;23
-21
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Float&lt;/strong&gt; - This is just any valid number that contains a decimal point. For Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;33.341416
-575.6474562
0.425
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Boolean&lt;/strong&gt; - this is a data type that can be one of two values: either True or False. For Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;True
False
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1.2 Python Operators
&lt;/h2&gt;

&lt;p&gt;Python offers many different operators for working with and comparing data types. For Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Arithmetic Operators&lt;/strong&gt; - This operators are for doing arithmetic; addition, subtraction, multiplication, division, and others.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**  Exponent 
%   Modulus/remainder 
//  Integer division/floored quotient 
/   Division 
*   Multiplication 
-   Subtraction 
+   Addition
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Comparison Operators&lt;/strong&gt; - This compares two values and evaluate down to a single Boolean value. For Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;==  Equal to
!=  Not equal to
&amp;lt;   Less than
&amp;gt;   Greater than
&amp;lt;=  Less than or equal to
&amp;gt;=  Greater than or equal to
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'hello' == 'hello' # True
'hello' == 'Hello' # False
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Boolean Operators&lt;/strong&gt; - This operators compare Boolean values.
&lt;strong&gt;and&lt;/strong&gt; - binary operator(always take two Boolean values) that evaluates an expression to True if both Boolean values are True, otherwise, it evaluates to False. For Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;True and True   # True
True and False  # False
False and False # False
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;or&lt;/strong&gt; - binary operator that evaluates an expression to True if either of the two Boolean values is True . If both are False , it evaluates to False. For Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;True or True    # True
True or False   # True
False or False  # False
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;not&lt;/strong&gt; - Evaluates to the opposite Boolean value. For Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;not True    # False
not False   # True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1.3 Variables and Keywords
&lt;/h2&gt;

&lt;p&gt;A variable is like a box in the computer’s memory where you can store a single value that can be accessed later. We create a variable by using variable name, an equal sign (assignment operator), and the value to be stored. For Example: &lt;br&gt;
name = 'Elkanah Malonza'&lt;/p&gt;

&lt;p&gt;Rules of creating a variable&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It can be only one word.&lt;/li&gt;
&lt;li&gt;It can use only letters, numbers, and the underscore ( _ ) character.&lt;/li&gt;
&lt;li&gt;It can’t begin with a number.&lt;/li&gt;
&lt;li&gt;It cannot be a keyword. keywords have special meaning in any programming language.
Here is a list of keywords in Python.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6HH00URs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ysm3tfx898imcc5zw30p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6HH00URs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ysm3tfx898imcc5zw30p.png" alt="Python Keywords" width="551" height="176"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  1.4 Flow Control Statements
&lt;/h2&gt;

&lt;p&gt;Flow control statements decides which Python instructions to execute under which conditions. Flow control statements often start with a part called the condition, and followed by a block of code called the clause. Condition are Boolean expressions that when evaluates to true execute the clause.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.4.1 if...elif..else statements&lt;/strong&gt; &lt;br&gt;
An if statement’s clause will execute if the statement’s condition is True and skipped if the condition is False.&lt;br&gt;
It can be optionally followed by several &lt;strong&gt;elif statement&lt;/strong&gt; , if you have a case where you want one of many possible clauses to execute. &lt;br&gt;
if clause can be optionally followed by an &lt;strong&gt;else statement&lt;/strong&gt;. The else clause is executed only when the if statement’s and/or elif statement condition is False .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if name == 'Elkanah':
    print('Hello Elkanah')
elif name == 'Malone':
    print('Hello Malone')
else:
    print('Hello')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1.4.2 while loops&lt;/strong&gt;&lt;br&gt;
The code in a while clause will be executed over and over, as long as the while statement’s condition is True.&lt;br&gt;
For Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;count = 0
while count &amp;lt; 5:
    print('Hello, world.')
    count = count + 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;strong&gt;break Statements&lt;/strong&gt; can be used to break out program execution of a while loop’s clause early.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;count = 0
while count &amp;lt; 5:
    print('Hello, world.')
    if count == 3:
        break
    count = count + 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;strong&gt;continue statement&lt;/strong&gt; causes program execution to immediately jumps back to the start of the loop and reevaluates the loop’s condition.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;count = 0
while count &amp;lt; 5:
    count = count + 1
    if count == 3:
        continue
    print(count)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1.4.3 for loops and the range() Function&lt;/strong&gt;&lt;br&gt;
For loops are used to execute a block of code only a certain number of times.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for i in range(10):
    print('Malone Ten Times')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1.5 Function
&lt;/h2&gt;

&lt;p&gt;Functions provide a way to compartmentalize your code into small tasks that can be called from multiple places within an app. It also make you avoid duplicating code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.5.1 Inbuilt Functions&lt;/strong&gt; &lt;br&gt;
This are function that are provided by python by default. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print('I love Python')
name = input("Enter Your Name: ")
print(name)
len(name)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All in in-built functions in Python 3.7&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FiZ1pL7a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ri0ry17own7zqbiwd0g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FiZ1pL7a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ri0ry17own7zqbiwd0g.png" alt="In-built functions" width="732" height="311"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;1.5.2 Defining a function&lt;/strong&gt;&lt;br&gt;
You can also define your own functions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def intro():
    print("Hello Stranger.")
    print("I love Python.")

intro()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1.5.3 Function with arguments&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can also define your own functions that accept arguments.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def add(x,y):
    z = x + y
    print(z)

add(3,8) # 11
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Return Values and return Statements
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def add(x,y):
    return x + y

add(2,3) # 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Defining optional parameters with defaults
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def add(x=0,y=0):
    return x + y

add() # 0
add(4) # 4
add(2,3) # 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1.5.4 Using keyword arguments (kwargs)&lt;/strong&gt;&lt;br&gt;
You can tell the function which parameter will have what value by using the syntax parameter = value in the code that’s calling the function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def divide(x,y):
    return x/y

divide(y=2, x=3) # 1.5
divide(x=2, y=3) # 0.6666666666666666
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1.5.5 *args - Passing in an arbitrary number of arguments&lt;/strong&gt;&lt;br&gt;
You can also design the function so that it accepts any number of arguments, use &lt;code&gt;*args&lt;/code&gt; as the parameter name.&lt;br&gt;
Whatever you pass in becomes a tuple named &lt;code&gt;args&lt;/code&gt; inside the function. A tuple is an immutable list (a list you can’t change).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def sorter(*args):
    newlist = list(args)
    # Sort and show the list.
    newlist.sort()
    return newlist

sorter(2, 0.42, -42,4.24, 25, 5)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1.5.6 Anonymous Functions/lambda functions.&lt;/strong&gt;&lt;br&gt;
The anonymous because function doesn’t need to have a name.&lt;br&gt;
&lt;code&gt;Syntax: Lambda arguments : expression&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;percent = lambda n : f"{n:.2%}"
print(percent(.6)) # 60.00%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1.6 Python Data Structures
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1.6.1 Lists&lt;/strong&gt;&lt;br&gt;
A list is a value that contains multiple values in an ordered sequence. A list begins with an opening square bracket and ends with a closing square bracket, []. Values inside the list are also called items which are separated with commas. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get individual values in a List we use Indexes. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
print(subjects[0]) # Maths 
print(subjects[0]) # Physics 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List have methods like &lt;code&gt;append()&lt;/code&gt;, &lt;code&gt;insert()&lt;/code&gt;, &lt;code&gt;pop()&lt;/code&gt;, &lt;code&gt;remove()&lt;/code&gt;... etc, that can be of use when writing python code. You need to master all of them. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.6.2 Tuples&lt;/strong&gt;&lt;br&gt;
A tuple is just an immutable list. In other words, a tuple is a list, but after it’s defined you can’t change it. &lt;br&gt;
Tuples are typed with parentheses, ( and ) , instead of square brackets, [ and ].&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ('History', 'Geography', 'Biology', 'Physics', 'Maths')
num = (5, 7, 8, 5, 3, 8, 5, 2, 1, 8, 5, 7)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List methods and techniques that modified list data won't work with tuple but the rest will.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.6.3 Sets&lt;/strong&gt;&lt;br&gt;
Python Sets is also a means of organizing data. The difference between a set and a list is that the items in set have no specific order. Even though you may define the set with the items in a certain order, none of the items get index numbers to identify their positions.&lt;/p&gt;

&lt;p&gt;To define a set, use curly braces where you would have used square brackets  for a list and parentheses for a tuple. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = {'Maths', 'Physics', 'Biology', 'Geography', 'History'}
num = {5, 7, 8, 5, 3, 8, 5, 2, 1, 8, 5, 7}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can’t change the order of items in a set, so you cannot use &lt;code&gt;.sort()&lt;/code&gt; to sort the set or &lt;code&gt;.reverse()&lt;/code&gt; to reverse its order. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.6.1 Dictionaries&lt;/strong&gt;&lt;br&gt;
Like a list, a dictionary is a collection of many values, but unlike indexes for lists, indexes for dictionaries can use many different data types, not just integers. &lt;br&gt;
Indexes for dictionaries are called keys, and a key with its associated value is called a key-value pair.&lt;br&gt;
In code, a dictionary is typed with braces, {}. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;person = {
    "name": "Elkanah",
    "gender": "Male",
    "height": "5.9 Foot",
    "weight": "67 kg",
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can access these values through their keys:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(person["name"]) # Elkanah
print(person["height"]) # 5.9 Foot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Like lists, Dictionaries too have methods for instance &lt;code&gt;clear(), copy(), fromkeys(), get(), items(), keys(), pop(), popitem(), setdefault(), update()&lt;/code&gt; and  &lt;code&gt;values()&lt;/code&gt; . This methods are used to manage data in a Dictionary. You need to know how to use them.&lt;/p&gt;

&lt;h2&gt;
  
  
  1.7 Classes and Objects, Inheritance
&lt;/h2&gt;

&lt;p&gt;Like functions, classes also allow you to compartmentalize code and data. &lt;br&gt;
&lt;strong&gt;Class&lt;/strong&gt; - A piece of code from which you can generate a unique object, where each object is a single instance of the class. &lt;br&gt;
&lt;strong&gt;Attribute&lt;/strong&gt; - A characteristic of an object that contains information about the object. &lt;br&gt;
&lt;strong&gt;Method&lt;/strong&gt; - A Python function that’s associated with the class. It defines an action that object can perform. &lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Dog:
    def __init__(self, age, name):
        self.age = age
        self.name = name

    def change_name(self, new_name):
        self.name = new_name

    def display_name(self):
        print(self.name)

    def display_age(self):
        print(self.age)


puppy = Dog(3, 'TOM')
puppy.display_age()
puppy.display_name()
puppy.change_name("Cindy")
puppy.display_name()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Inheritance&lt;/strong&gt;&lt;br&gt;
inheritance is defined by creating sub-classes within a class.&lt;br&gt;
&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class parent:
   statements
class child(parent):
   statements
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sub-classes inherit all the attributes and methods of some higher-level main class, or parent class, which is usually referred to as the base class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Quadrilateral:
    def __init__(self, a, b, c, d):
        self.a = a
        self.b = b
        self.c = c
        self.d = d

    def perimeter(self):
        p = self.a + self.b + self.c + self.d
        print("perimeter: ", p)


q1 = Quadrilateral(4, 5, 7, 9)
q1.perimeter()


class Rectangle(Quadrilateral):
    def __init__(self, a, b):
        super(Rectangle, self).__init__(a, b, b, a)

    def area(self):
        area = self.a * self.b
        print("Area:", area)


r1 = Rectangle(20, 10)
r1.perimeter()
r1.area()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1.8 Handling the error and exceptions - try..except..else..finally
&lt;/h2&gt;

&lt;p&gt;Getting an error, or exception, in your Python program means the entire program will crash. You don’t want this to happen in real-world programs. Example:&lt;br&gt;
&lt;code&gt;dummy_file = open('random_file.csv')&lt;/code&gt;&lt;br&gt;
&lt;code&gt;# FileNotFoundError: [Errno 2] No such file or directory: 'random_file.csv'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Above program creates a &lt;code&gt;FileNotFoundError&lt;/code&gt; and stops executing. We want the program to detect errors, handle them, and then continue to run. That's where &lt;code&gt;try...except...else...finally...&lt;/code&gt; Statements comes in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try:
    # Open file and shows its name.
    dummy_file = open('random_file.csv')
    print(dummy_file.name)
except Exception:
    print("Sorry, File named random_file.csv Does not Exist.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Being Specific about Exceptions&lt;/em&gt;
Sometimes we need to catch a specific error. For Instance, &lt;code&gt;FileNotFoundError&lt;/code&gt; in above code. You add the exception name after the except statement.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try:
    # Open file and shows its name.
    dummy_file = open('random_file.csv')
    print(dummy_file.name)
except FileNotFoundError:
    print("Sorry, File named random_file.csv Does not Exist.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;One Try statement can be followed by multiple except statement.&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try:
    ...
except FileNotFoundError:
    print("Sorry, File named random_file.csv Does not Exist.")
except Exception as e:
    print(e)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;else block&lt;/em&gt;
Code in this block will be executed if no exceptions raised
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try:
    ...
except FileNotFoundError:
    print("Sorry, File named random_file.csv Does not Exist.")
except Exception as e:
    print(e) 
else:
    # Continue on here only if no exceptions raised

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;finally block&lt;/em&gt;
if included, the code in this block will run whether an exception occurs or not.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try:
    try to do this
except:
    if x happens, stop here
except Exception as e:
    if something else bad happens, stop here
else:
    if no exceptions, continue on normally here
finally:
    do this code no matter what happened above
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1.9 Importing libraries
&lt;/h2&gt;

&lt;p&gt;Python comes with a set of modules called the &lt;strong&gt;standard library&lt;/strong&gt; - which is a Python program that contains a related group of functions that can be embedded in your programs. Before you can use the functions in a module, you must import the module with an import statement.&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt; the random module has random number–related functions,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import random

for i in range(15):
    print(random.randint(1, 10))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; the math module has mathematics related functions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import math

print(math.sqrt(81))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1.10 String In-depth
&lt;/h2&gt;

&lt;p&gt;In data types you learnt about string data type. In python, You can do more with strings other than write, print, and access strings. You can extract partial strings from string values, add or remove spacing, convert letters to lowercase or uppercase, check that strings are formatted correctly, etc. This is easily done by use of different string method, indexes and slices and other in-built functions. Example of indexes, slices and in-built functions.&lt;br&gt;
&lt;code&gt;s[i:j:k]&lt;/code&gt; - A slice of s from i to j with step k.&lt;br&gt;
&lt;code&gt;min(s)&lt;/code&gt; - The smallest (lowest) item of string s, uses Ascii (space is smaller than a-z,A-Z)&lt;br&gt;
&lt;code&gt;max(s)&lt;/code&gt; - The largest (highest) item of string s.&lt;/p&gt;

&lt;p&gt;Their are over 30 string methods in python. They will come in handy if you know how to use them. Here are a few of them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1.11 Numbers in-depth
&lt;/h2&gt;

&lt;p&gt;You can also do more with int and float Data types other than declaring them and doing arithmetic operation on them. Below are in-built function that can manipulate Numbers in python.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;abs(x)&lt;/strong&gt; - Returns the absolute value of number x (converts negative numbers to positive)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;bin(x)&lt;/strong&gt; Returns a string representing the value of x converted to binary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;float(x)&lt;/strong&gt; Converts a string or number x to a the float data type&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;format(x,y)&lt;/strong&gt; - Returns x formatted as directed by format string y.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;hex(x)&lt;/strong&gt; - Returns a string containing x converted to hexadecimal, prefixed with 0x.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;int(x)&lt;/strong&gt; - Converts x to the integer data type by truncating (not rounding) the decimal point and any digits after it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;max(x,y,z ...)&lt;/strong&gt; - Takes any number of numeric arguments and returns whichever one is the largest.&lt;/li&gt;
&lt;li&gt;*&lt;em&gt;min(x,y,z ...) *&lt;/em&gt; - Takes any number of numeric arguments and returns whichever one is the smallest.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;oct(x)&lt;/strong&gt; - Converts x to an octal number, prefixed with 0o to indicate octal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;round(x,y)&lt;/strong&gt; - Rounds the number x to y number of decimal places.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to do complex math operation on numbers like trigonometry, hyperbolic, powers and logarithms, angular conversions, constants like pi and e, import the math module. Below are some of the methods and attributes of math module:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'pi', 'pow', 'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1.12 Date and time
&lt;/h2&gt;

&lt;p&gt;To work with dates and times, you typically need to use the datetime module.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Import the datetime module with nickname dt*
&lt;code&gt;import datetime as dt&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1.12.1 Working with Dates&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A date consisting of month, day, and year (no time information).
&lt;code&gt;variable = datetime.date(year, month, day)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Store today's date in a variable named today.*
&lt;code&gt;today = dt.date.today()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Store some other date in a variable called birth_date*
birth_date = dt.date(2019, 12, 31)&lt;/li&gt;
&lt;li&gt;Accessing Month, Day and Year
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(birth_date.month)
print(birth_date.day)
print(birth_date.year)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1.12.2 Working with times&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A time consisting of hour, minute, second, microsecond, and optionally time zone information if needed (but no date).&lt;/li&gt;
&lt;li&gt;If you want to work strictly with time data, use the &lt;code&gt;datetime.time&lt;/code&gt; class. The basic syntax for defining a time object using the time class is 
&lt;code&gt;variable = datetime.time([hour,[minute,[second,[microsecond]]]])&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;all the arguments are optional
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;midnight = dt.time() # 00:00:00
just_morning = dt.time(06,09,00)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1.12.3 Working with date and time&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A single item of data that includes date, time, and optionally time zone information.
&lt;code&gt;variable = datetime.datetime(year, month, day, hour, [minute, [second, [microsecond]]])&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The month, day, and year are required. The rest are optional and set to zero in the time if you omit them.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import datetime as dt
new_years_eve = dt.datetime(2019,12,31,23,59)
print(new_years_eve)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1.12.4 Formatting Strings for Dates and Times&lt;/strong&gt;&lt;br&gt;
The default date display is yyyy-mm-dd, but you can format dates and times however you want using f-strings. Learn how to use the right directives in f-strings and you will display date and time the way you like. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(f"{birth_date:%A, %B %d, %Y}")
today_s_date = f"{today:%m/%d/%Y}"
print(today_s_date) # 03/03/2022
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;**&lt;br&gt;
1.12.5 Time Delta**&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;timedelta&lt;/code&gt; happens automatically when you subtract one date from another to get the time between.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;new_year = dt.date(2022, 1, 1)
birth_day = dt.date(2022, 5, 27)
days_between = birth_day - new_year
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;You can also define any timedelta (duration) using this syntax:
&lt;code&gt;datetime.timedelta(days=, seconds=, microseconds=, milliseconds=, minutes=, hours=, weeks=)&lt;/code&gt;
If you omit an argument, its value is set to zero.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import datetime as dt
new_years = dt.date(2022,1,1)
duration = dt.timedelta(days=146)
print(new_year + duration) # 2022-05-27
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import datetime as dt
now = dt.datetime.now()
birthdatetime = dt.datetime(1997, 1, 19, 6, 00)
age = now - birthdatetime
print(age) # 9174 days, 15:13:05.474595
print(type(age)) # &amp;lt;class 'datetime.timedelta'&amp;gt;

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

&lt;/div&gt;

&lt;h2&gt;
  
  
  2. Intermediate Python
&lt;/h2&gt;
&lt;h3&gt;
  
  
  2.1 Regular Expressions (regexes)
&lt;/h3&gt;

&lt;p&gt;Regular expressions are huge time-savers for programmers. They allow you to specify a pattern of text to search for or filter. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;All the regex functions in Python are in the re module.&lt;br&gt;
&lt;code&gt;import re&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Passing a string value representing your regular expression to &lt;code&gt;re.compile()&lt;/code&gt; returns a Regex pattern object&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A Regex object’s method &lt;code&gt;search()&lt;/code&gt; looks for the first instance, &lt;code&gt;findall()&lt;/code&gt; looks for all matching instance and&lt;br&gt;
the sub() method for substituting all matching strings&lt;br&gt;
with string specified.&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt; Matching Kenya Phone Numbers (+254)712345678 | 0765-432-123 | 0722004445&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import re

def extract_phone_num(text):
    kenya_pattern = r"(\(\+\d{3}\)\d{9})|(\d{4}-\d{3}-\d{3})|(\d{10})"
    matching = re.compile(kenya_pattern)
    return matching.findall(text)


my_text = "(+254)734423363 0714-134-941This is 0756464654 just a text with random 0756464654 Kenyan Phone Numbers " \
          "(+254)718306114 0718-306-114 blah 0756464654 blah 07013-213-311 0756464654"
print(extract_phone_num(my_text))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Result:&lt;br&gt;
&lt;code&gt;[('(+254)734423363', '', ''), ('', '0714-134-941', ''), ('', '', '0756464654'), ('', '', '0756464654'), ('(+254)718306114', '', ''), ('', '0718-306-114', ''), ('', '', '0756464654'), ('', '7013-213-311', ''), ('', '', '0756464654')]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now that you know the basic steps for creating and finding regular expression objects with Python. You need to learn some more powerful pattern-matching capabilities. Learn the regex symbols used in patterns. For Instance: &lt;code&gt;r"(\(\+\d{3}\)\d{9})|(\d{4}-\d{3}-\d{3})|(\d{10})"&lt;/code&gt;. Learn how to make your search Case-sensitive and substituting strings matched. &lt;/p&gt;
&lt;h3&gt;
  
  
  2.2 File Operations
&lt;/h3&gt;

&lt;p&gt;File Operations involves how to use Python to create, read, and save files on the hard drive. The files can be both text or binary files. It also involves organize preexisting files on the hard drive For Instance: copying, renaming, moving, or compressing them.&lt;br&gt;
&lt;strong&gt;File Paths&lt;/strong&gt;&lt;br&gt;
But before you learn how to code file operations, you should be comfortable working with file paths in Python. The &lt;code&gt;path&lt;/code&gt; module in &lt;code&gt;os&lt;/code&gt; module makes it simple to work with file paths.&lt;br&gt;
The &lt;code&gt;os.path&lt;/code&gt; methods and attributes that make it easy to work with files paths are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'abspath', 'altsep', 'basename', 'commonpath', 'commonprefix', 'curdir', 'defpath', 'devnull', 'dirname', 'exists', 'expanduser', 'expandvars', 'extsep', 'genericpath', 'getatime', 'getctime', 'getmtime', 'getsize', 'isabs', 'isdir', 'isfile', 'islink', 'ismount', 'join', 'lexists', 'normcase', 'normpath', 'os', 'pardir', 'pathsep', 'realpath', 'relpath', 'samefile', 'sameopenfile', 'samestat', 'sep', 'split', 'splitdrive', 'splitext', 'stat', 'supports_unicode_filenames', 'sys'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Learn how to work with above attributes and methods.&lt;br&gt;
Their are others &lt;code&gt;os&lt;/code&gt; methods apart from those found in &lt;code&gt;os.path&lt;/code&gt; that used to manage files and file paths. Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;os.getcwd()&lt;/code&gt; - get current working directory&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;os.chdir(&amp;lt;path&amp;gt;)&lt;/code&gt; - change directory&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;os.makedirs(&amp;lt;path&amp;gt;)&lt;/code&gt; - create new folder/directory&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;os.listdir(path)&lt;/code&gt; - returns a list of filename strings for each file in the path argument.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The File Reading/Writing Process&lt;/strong&gt;&lt;br&gt;
If you are comfortable working with folders and file paths, lets specify the location of files to read and write.&lt;br&gt;
The following are functions for opening, reading and writing &lt;strong&gt;Text&lt;/strong&gt; files.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;open()&lt;/strong&gt; - function to return a File object. default read mode&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;open('', 'w')&lt;/strong&gt; - open file for writing. Replace 'w' with 'a' to open file in append mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;read()&lt;/strong&gt; - method on the File object to read its content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;readlines()&lt;/strong&gt; - method to get a list of string values from the file, one string for each line of text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;write()&lt;/strong&gt; - method on the File object to write content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;close()&lt;/strong&gt; - Close the file by calling the method on the File object.
Example:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;file_x = open('/users/path_to_folder/my_file.txt')
file_x.readlines()
file_x.close()
file_x = open('/users/path_to_folder/my_file.txt', 'w')
file_x.write('Hello world!\n') 
file_x.close()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;shelve Module&lt;/strong&gt;&lt;br&gt;
You can save variables in your Python programs to binary shelf files using the shelve module.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Save
shelfFile = shelve.open(&amp;lt;filename&amp;gt;)
cats = ['Zophie', 'Pooka', 'Simon']
shelfFile['cats'] = cats
shelfFile.close()
# Open
shelfFile = shelve.open('mydata')
shelfFile['cats']
# ['Zophie', 'Pooka', 'Simon']
shelfFile.close()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Organizing File&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;import shutil # shell Utility&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;shutil.copy('source', 'destination')&lt;/strong&gt; - will copy a single file&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;shutil.copytree(source, destination)&lt;/strong&gt; - will copy the folder with all of its files and sub-folders&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;shutil.move(source, destination)&lt;/strong&gt; - will move file from source to destination.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;os.unlink(path)&lt;/strong&gt; - will delete the file at path .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;os.rmdir(path)&lt;/strong&gt; - will delete the folder at path . This folder must be empty of any files or folders.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;shutil.rmtree(path)&lt;/strong&gt; - will remove the folder at path , and all files and folders it contains will also be deleted&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Safe Deletes with the &lt;code&gt;send2trash&lt;/code&gt; Module&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import send2trash
send2trash.send2trash('bacon.txt')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Walking THROUGH a Directory Tree&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;os.walk()&lt;/strong&gt; - will return three values on each iteration through A for loop&lt;/li&gt;
&lt;li&gt;A string of the current folder’s name&lt;/li&gt;
&lt;li&gt;A list of strings of the folders in the current folder&lt;/li&gt;
&lt;li&gt;A list of strings of the files in the current folder
Example:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import os

for folderName, subfolders, filenames in os.walk('/home/malone/PycharmProjects'):
    print('The current folder is ' + folderName)
    for subfolder in subfolders:
        print('SUBFOLDER OF ' + folderName + ': ' + subfolder)
        for filename in filenames:
            print('FILE INSIDE ' + folderName + ': ' + filename)
            print('')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  2.3 Making your own module/library
&lt;/h2&gt;

&lt;p&gt;We have already mentioned that modules are collections of pre-written code that you can &lt;code&gt;import&lt;/code&gt; and use in your own code.&lt;br&gt;
A module is just a file with a .py filename extension. The name of the module is the same as the filename without the &lt;code&gt;.py&lt;/code&gt; file extension. Yeah, it is that simple.&lt;/p&gt;

&lt;p&gt;Example if I have a python file named &lt;code&gt;email_app.py&lt;/code&gt;, inside the file are function like send_email(), inbox(), sent_box() and drafts() and Global Variables like EMAIL and PORT. I can import this module as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import email_app
email_app.inbox()
print(email_app.PORT)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;After going through the above Python concepts and learning them in details (I was just pointing them out, I didn't go into details), you will find it easy for you to venture in Data Science, Web Development and Other Python fields without a hustle. Their are some interesting topics like Web Scrapping, Scheduling Tasks and Launching Programs, Creating and manipulating binary files(PDFs, Word Doc, Excel, CSV Files), Network Programming, Sending Emails and Manipulating Images that I have left out. This topics are easy because all you do is import the respective module and working with their methods and attributes. But if you have not mastered the basics, they will definitely be hard.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Introduction to Data Structures and Algorithms With Python</title>
      <dc:creator>Elkanah Malonza</dc:creator>
      <pubDate>Mon, 21 Feb 2022 10:52:16 +0000</pubDate>
      <link>https://dev.to/malonzaelkanah/introduction-to-data-structures-and-algorithms-with-python-21oh</link>
      <guid>https://dev.to/malonzaelkanah/introduction-to-data-structures-and-algorithms-with-python-21oh</guid>
      <description>&lt;p&gt;Python provides data types that provides a flexible way to access and organize multiple data. They are called Data Structures. Data Structures are a specialized means of organizing and storing data in computers in such a way that we can perform operations on the stored data more efficiently.&lt;br&gt;
A &lt;strong&gt;Data structure&lt;/strong&gt; is a particular way of organizing data in a computer so that it can be used effectively. It is a specialized format for organizing, processing, retrieving and storing data. &lt;br&gt;
&lt;strong&gt;Algorithm&lt;/strong&gt; on the hand is a set of well-defined instructions in calculation or to solve a particular problem.&lt;/p&gt;

&lt;p&gt;The basic Python data structures in Python include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Lists&lt;/li&gt;
&lt;li&gt;Tuples&lt;/li&gt;
&lt;li&gt;Sets&lt;/li&gt;
&lt;li&gt;Dictionaries&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Their some data structures that are user-defined (not part of python data types). They include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stack - LIFO&lt;/li&gt;
&lt;li&gt;Queues - FIFO&lt;/li&gt;
&lt;li&gt;Linked Lists&lt;/li&gt;
&lt;li&gt;Hash Tables&lt;/li&gt;
&lt;li&gt;Trees&lt;/li&gt;
&lt;li&gt;Graphs&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;1. Lists&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A &lt;em&gt;list&lt;/em&gt; is a value that contains multiple values in an ordered sequence. A list begins with an opening square bracket and ends with a closing square bracket, []. Values inside the list are also called &lt;em&gt;items&lt;/em&gt; which are separated with commas. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To get &lt;strong&gt;individual values&lt;/strong&gt; in a List we use Indexes. Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
# subjects[0] will evaluate to Maths
print(subjects[0]) # Maths 
# subjects[1] will evaluate to Physics
print(subjects[0]) # Physics 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The integer inside the square brackets that follows the list is called an &lt;em&gt;index&lt;/em&gt;. The first value in the list is at index 0 , the second value is at index 1 , the third value is at index 2 , and so on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Python will give you an &lt;em&gt;&lt;strong&gt;IndexError&lt;/strong&gt;&lt;/em&gt; error message if you use an index that exceeds the number of values in your list value.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lists can also &lt;strong&gt;contain other list values&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;food = [['tea', 'coffee', 'water'], ['beef', 'pork', 'mutton', 'fish', 'chicken'], ['rice', 'pasta']]
beverage = food[0]
print(beverage) # ['tea', 'coffee', 'water']
# print individual value
print(food[1][3]) # 'fish'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first index dictates which list value to use, and the second indicates the value within the list value. Example:&lt;br&gt;
&lt;code&gt;food[1][3] # 'fish'&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;negative indexes&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also use negative integers for the index. The integer value -1 refers to the last index in a list, the value -2 refers to the second-to-last index in a list, and so on. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
print(num[-1]) # 0
print(num[-2]) # 9
print(num[-5]) # 6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Slicing a List to get a Sub-lists&lt;/strong&gt;
A slice can get several values from a list, in the form of a new list. A slice is typed between square brackets, like an index, but it has two integers separated by a colon.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
print(subjects[1:4]) # ['Physics', 'Biology', 'Geography']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first integer in a slice is the index where the slice starts. The second integer is the index where the slice ends but will not include it.&lt;/p&gt;

&lt;p&gt;Leaving out the first index is the same as using 0 , or the beginning of the list. Leaving out the second index is the same as using the length of the list, which will slice to the end of the list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
print(subjects[:3]) # ['Maths', 'Physics', 'Biology']
print(subjects[3:]) # ['Geography', 'History']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Changing Values in a List&lt;/strong&gt; with Indexes
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
subject[0] = 'Mathematics'
print(subject) # ['Mathematics', 'Physics', 'Biology', 'Geography', 'History']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Adding two lists&lt;/strong&gt; using + operator
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;core_subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
supplementary_subjects = ['Programming', 'Sports', 'Communication']
subjects = core_subjects + supplementary_subjects
print(subjects)  
['Maths', 'Physics', 'Biology', 'Geography', 'History', 'Programming', 'Sports', 'Communication']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Replicating a list&lt;/strong&gt; using * operator
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;num = [1, 3, 5]
print(num*3) # [1, 3, 5, 1, 3, 5, 1, 3, 5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Removing Values from Lists&lt;/strong&gt; with del Statements
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
del subjects[2]
print(subjects) # ['Maths', 'Physics', 'Geography', 'History']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Using for Loops&lt;/strong&gt; with Lists
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
for sub in subjects:
    print(sub)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;in and not in Operators&lt;/strong&gt;
You can determine whether a value is or isn’t in a list with the in and not in operators.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']

print('Physics' in subjects) # True

print('Physics' not in subjects) # False

print('Programming' in subjects) # False

print('Programming' not in subjects) # True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Getting a &lt;strong&gt;List’s Length&lt;/strong&gt; with len()
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
print(len(subjects))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multiple Assignment&lt;/strong&gt; using Lists&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can assign multiple variables with the values in a list in one line of code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
maths, physics, bio, geo, history = subjects
print(geo) # 'Geography'
print (physics) # 'Physics'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Converting Types&lt;/strong&gt; with the list() Functions
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;line1 = 'hello'
line1_list = list(line1)
print(line1_list) # ['h', 'e', 'l', 'l', 'o']

subjects = ('History', 'Geography', 'Biology', 'Physics', 'Maths')
subjects = list(subjects) # ['History', 'Geography', 'Biology', 'Physics', 'Maths']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;List Methods&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;append()&lt;/em&gt;&lt;/strong&gt; - Adds an item to the end of the list.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;clear()&lt;/em&gt;&lt;/strong&gt; - Removes all items from the list, leaving it empty.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;copy()&lt;/em&gt;&lt;/strong&gt;  - Makes a copy of a list.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;count()&lt;/em&gt;&lt;/strong&gt; - Counts how many times an element appears in a list.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;extend()&lt;/em&gt;&lt;/strong&gt; - Appends the items from one list to the end of another list.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;index()&lt;/em&gt;&lt;/strong&gt; - Returns the index number (position) of an element within a list.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;insert()&lt;/em&gt;&lt;/strong&gt; - Inserts an item into the list at a specific position.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;pop()&lt;/em&gt;&lt;/strong&gt; - Removes an element from the list, and provides a copy of that item that you can store in a variable.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;remove()&lt;/em&gt;&lt;/strong&gt; - Removes one item from the list.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;reverse()&lt;/em&gt;&lt;/strong&gt;  - Reverses the order of items in the list.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;sort()&lt;/em&gt;&lt;/strong&gt; - Sorts the list in ascending order. Put reverse=True inside the parentheses to sort in descending order.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;index()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
print(subject.index('Physics')) # 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;append()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
subject.append('Programming') 
print(subject) # ['Maths', 'Physics', 'Biology', 'Geography', 'History', 'Programming']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;insert()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
subject.insert('Programming', 1) 
print(subject) # ['Maths', 'Programming', 'Physics', 'Biology', 'Geography', 'History']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;remove()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
subject.remove('Biology') 
print(subject) # ['Maths', 'Physics', 'Geography', 'History']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; If the value appears multiple times in the list, only the first instance of the value will be removed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;sort()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Arrange in alphabetical order
subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
subjects.sort() 
print(subjects) # ['Biology', 'Geography', 'History', 'Maths', 'Physics' ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Arrange in numeric order
random_num = [5, 5, 3, 8, 2, 1, 8, 0, 7]
random_num.sort() # [0, 1, 2, 3, 5, 5, 7, 8, 8]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;You can also pass &lt;strong&gt;True&lt;/strong&gt; for the reverse keyword argument to have sort() sort the values in &lt;strong&gt;reverse order&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;random_num = [5, 5, 3, 8, 2, 1, 8, 0, 7]
random_num.sort(reverse=True) # [8, 8, 7, 5, 5, 3, 2, 1, 0]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;you cannot sort lists that have both number values and string values in them, since Python doesn’t know how to compare these values.&lt;/li&gt;
&lt;li&gt;sort() uses “&lt;strong&gt;ASCIIbetical order&lt;/strong&gt;” rather than actual alphabetical order for sorting strings. This means uppercase letters come before lower-case letters.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spam = ['Alice', 'ants', 'Bob', 'badgers', 'Carol', 'cats']
spam.sort() # ['Alice', 'Bob', 'Carol', 'ants', 'badgers', 'cats']

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;you need to sort the values in regular alphabetical order, pass &lt;strong&gt;str.lower&lt;/strong&gt; for the key keyword argument in the sort() method call.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spam = ['a', 'z', 'A', 'Z']
spam.sort(key=str.lower) # ['a', 'A', 'z', 'Z']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;pop()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']

# remove last subject
last_subject = subjects.pop()
print(subjects) # ['Maths', 'Physics', 'Biology', 'Geography']
print(last_subject) # 'History'

# remove first subject
first_subject = subjects.pop(0)
print(subjects) # ['Physics', 'Biology', 'Geography']
print(first_subject) # 'Maths' 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;count()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;num = [5, 7, 8, 5, 3, 8, 5, 2, 1, 8, 5, 7]
num_count = num.count(5)
print(num_count) # 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;extend()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
supplementary_subjects = ['Programming', 'Sports', 'Communication']
subjects.extend(supplementary_subjects)
print(subjects) # ['Maths', 'Physics', 'Biology', 'Geography', 'History', 'Programming', 'Sports', 'Communication']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;clear()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
subjects.clear()
print(subjects) # [ ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;reverse()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
subjects.reverse()
print(subjects) # ['History', 'Geography', 'Biology', 'Physics', 'Maths']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;copy()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
subject_copy = subjects.copy()
print(subject_copy) # ['Maths', 'Physics', 'Biology', 'Geography', 'History']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Tuple
&lt;/h2&gt;

&lt;p&gt;A &lt;em&gt;tuple&lt;/em&gt; is just an immutable list. In other words, a tuple is a list, but after it’s defined you can’t change it. Tuples are typed with parentheses, ( and ) , instead of square brackets, [ and ]. &lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ('History', 'Geography', 'Biology', 'Physics', 'Maths')
num = (5, 7, 8, 5, 3, 8, 5, 2, 1, 8, 5, 7)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List methods and techniques that modified list data won't with tuple but other methods will work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(num.count(5)) # 4
print(type(subjects)) # &amp;lt;class 'tuple'&amp;gt;
print(len(num)) # 12
print('Physics' in subjects) # True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Converting to Tuple Types&lt;/strong&gt; with tuple() Functions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = ['Maths', 'Physics', 'Biology', 'Geography', 'History']
subjects = tuple(subjects)
print(subjects) # ('Maths', 'Physics', 'Biology', 'Geography', 'History')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Sets
&lt;/h2&gt;

&lt;p&gt;Python Sets is also a means of organizing data. The difference between a set and a list is that the items in set have no specific order. Even though you may define the set with the items in a certain order, none of the items get index numbers to identify their positions.&lt;/p&gt;

&lt;p&gt;To define a set, use curly braces where you would have used square brackets for a list and parentheses for a tuple. &lt;strong&gt;For example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = {'Maths', 'Physics', 'Biology', 'Geography', 'History'}
num = {5, 7, 8, 5, 3, 8, 5, 2, 1, 8, 5, 7}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can’t change the order of items in a set, so you cannot use .sort() to sort the set or .reverse() to reverse its order. You can use len() to determine size of set and in operator to check if an item exists.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;add()&lt;/em&gt;&lt;/strong&gt; - You can add a single new item to a set
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = {'Maths', 'Physics', 'Biology', 'Geography', 'History'}
subjects.add('Programming')
print(subjects) # {'Maths', 'Physics', 'Biology', 'Geography', 'History', 'Programming'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;update()&lt;/em&gt;&lt;/strong&gt; - add multiple items to a set
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = {'Maths', 'Physics', 'Biology', 'Geography', 'History'}
subjects.update(['Programming', 'Sports', 'Communication'])
print(subjects) # {'Maths', 'Physics', 'Biology', 'Geography', 'History', 'Programming', 'Sports', 'Communication'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;copy()&lt;/em&gt;&lt;/strong&gt; - replicate a set
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subjects = {'Maths', 'Physics', 'Biology', 'Geography', 'History'}
subjects_copy = subjects.copy('Programming')
print(subjects_copy) # {'Maths', 'Physics', 'Biology', 'Geography', 'History'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Dictionary
&lt;/h2&gt;

&lt;p&gt;Like a list, a dictionary is a collection of many values, but unlike indexes for lists, indexes for dictionaries can use many different data types, not just integers. Indexes for dictionaries are called keys, and a key with its associated value is called a key-value pair.&lt;br&gt;
In code, a dictionary is typed with braces, {}. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;person = {
"name": "Elkanah",
"gender": "Male",
"Height": "5.9 Foot",
"Weight": "67 kg",
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;You can &lt;strong&gt;access these values&lt;/strong&gt; through their keys:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(person["name"]) # Elkanah
print(person["height"]) # 5.9 Foot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Unlike lists, items in dictionaries are &lt;strong&gt;unordered&lt;/strong&gt;. It does not matter in what order the key-value pairs are typed in a dictionary:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;person = {"name": "Elkanah", "gender": "Male", "Height": "5.9 Foot","Weight": "67 kg",}
person2 = {"Height": "5.9 Foot", "name": "Elkanah", "Weight": "67 kg", "gender": "Male",}

print(person==person1) # True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Changing the value&lt;/strong&gt; of a key in dictionary
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;person = {"name": "Elkanah", "gender": "Male", "Height": "5.9 Foot","Weight": "67 kg",}
person["name"] = "Malonza"
print(person) # {"name": "Malonza", "gender": "Male", "Height": "5.9 Foot","Weight": "67 kg",}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Dictionary Methods
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;clear()&lt;/em&gt;&lt;/strong&gt; - Empties the dictionary by remove all keys and values.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;copy()&lt;/em&gt;&lt;/strong&gt; - Returns a copy of the dictionary.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;fromkeys()&lt;/em&gt;&lt;/strong&gt; - Returns a new copy of the dictionary but with only specified keys and values.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;get()&lt;/em&gt;&lt;/strong&gt; -  Returns the value of the specified key, or None if it doesn’t exist.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;items()&lt;/em&gt;&lt;/strong&gt; -  Returns a list of items as a tuple for each key-value pair.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;keys()&lt;/em&gt;&lt;/strong&gt; - Returns a list of all the keys in a dictionary.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;pop()&lt;/em&gt;&lt;/strong&gt; - Removes the item specified by the key from the dictionary, and stores it in a variable.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;popitem()&lt;/em&gt;&lt;/strong&gt; - Removes the last key-value pair.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;setdefault()&lt;/em&gt;&lt;/strong&gt; - Returns the value of the specified key. If the key does not exist: insert the key, with the specified value.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;update()&lt;/em&gt;&lt;/strong&gt; - Updates the value of an existing key, or adds a new key-value pair if the specified key isn’t already in the dictionary.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;values()&lt;/em&gt;&lt;/strong&gt; - Returns a list of all the values in the dictionary.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;keys()&lt;/strong&gt;, &lt;strong&gt;values()&lt;/strong&gt;, and &lt;strong&gt;items() Methods&lt;/strong&gt; - will return list-like values of the dictionary’s keys, values, or both keys and values.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spam = {'color': 'red', 'age': 42}

v = spam.values()
print(v) # dict_values(['red', 42])

k = spam.keys()
print(k) # dict_keys(['color', 'age'])

kv = spam.items()
print(kv) # dict_items([('color', 'red'), ('age', 42)])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;get() Method&lt;/strong&gt; - takes two arguments: the key of the value to retrieve and a fallback value to return if that key does not exist.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;picnicItems = {'apples': 5, 'cups': 2}
print(picnicItems.get('cups', 0)) # 2
print(get('cups', 0)) # 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;setdefault() Method&lt;/strong&gt; - set a value in a dictionary for a certain key only if that key does not already have a value.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spam = {'name': 'Pooka', 'age': 5}

spam.setdefault('color', 'black')
print(spam) # {'color': 'black', 'age': 5, name: 'Pooka'}

spam.setdefault('color', 'white')
print(spam) # {'color': 'black', 'age': 5, name: 'Pooka'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;update() method&lt;/strong&gt; - to add a new item to a dictionary, or to change the value of a current key.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spam = {'name': 'Pooka', 'age': 5}

spam.update({'color': 'black'})
print(spam) # {'color': 'black', 'age': 5, name: 'Pooka'}

spam.update({'color': 'white'})
print(spam) # {'color': 'white', 'age': 5, name: 'Pooka'}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;copy() method&lt;/strong&gt; -  make a copy of a data dictionary to work with.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spam = {'name': 'Pooka', 'age': 5}
spam_copy = spam.copy()
print(spam_copy) # {name: 'Pooka', 'age': 5}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;clear() method&lt;/strong&gt; - remove all key-value pairs from a dictionary without deleting the entire dictionary
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spam = {'name': 'Pooka', 'age': 5}
spam.clear()
print(spam) # {}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;pop() method&lt;/strong&gt; - Removes the item specified by the key from the dictionary, and stores it in a variable.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spam = {'color': 'Black', 'name': 'Pooka', 'age': 5}
color = spam.pop("color")
print(spam) # {name: 'Pooka', 'age': 5}
print(color) # Black
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;popitem() method&lt;/strong&gt; -Remove the last key-value pair from a dictionary
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spam = {'color': 'Black', 'name': 'Pooka', 'age': 5}
color = spam.popitem()
print(spam) # {name: 'Pooka', 'age': 5}
print(color) # ('age', 5)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;fromkeys() method&lt;/strong&gt; - Returns a new copy of the dictionary but with only specified keys and values
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spam = {'color': 'Black', 'name': 'Pooka', 'age': 5}
spam1 = dict.fromkeys(spam.keys())
print(spam1) # {'color': None, 'name': None, 'age': None}

results = dict.fromkeys(['Maths', 'Physics', 'Biology', 'Geography', 'History'])
print(results) # {'Maths': None, 'Physics': None, 'Biology': None, 'Geography': None, 'History': None}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  5. Stack
&lt;/h2&gt;

&lt;p&gt;A stack is a linear data structure that follows the principle of Last In First Out (LIFO). This means the last element inserted inside the stack is removed. Stack has one end where the insertion and deletion happens i.e. from the top of the stack.&lt;br&gt;
&lt;strong&gt;operation in stack data structures&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;push()&lt;/em&gt;&lt;/strong&gt; - Pushing (storing) an element on the stack&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;pop()&lt;/em&gt;&lt;/strong&gt; - Removing (accessing) an element from the stack&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;peek()&lt;/em&gt;&lt;/strong&gt; - get the top data element of the stack, without removing it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;isEmpty()&lt;/em&gt;&lt;/strong&gt; - check if stack is empty.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;isFull()&lt;/em&gt;&lt;/strong&gt; - check if stack is full.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
# Creating a stack
def stack():
    stack = []
    return stack

# Creating an empty stack
def isEmpty(stack):
    return len(stack) == 0

# Adding items into the stack
def push(stack, item):
    stack.append(item)
    print("pushed item: " + item)

# Removing an element from the stack
def pop(stack):
    if (isEmpty(stack)):
        return "stack is empty"
    return stack.pop()

stack = stack()
push(stack, "me")
push(stack, "we")
push(stack, "us")

print("popped item: " + pop(stack))
print("stack after popping an element: ", stack)

'''output
pushed item: me
pushed item: we
pushed item: us
popped item: us
stack after popping an element:  ['me', 'we']
'''

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Queues
&lt;/h2&gt;

&lt;p&gt;A Queue is a linear data structure that follows the principle of &lt;strong&gt;First In First Out (FIFO)&lt;/strong&gt;. This means the first element inserted inside the stack is removed first. Stack has two end where one is for insertion &lt;strong&gt;(enqueue)&lt;/strong&gt; and the other is for deletion &lt;strong&gt;(dequeue)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;operations in queue data structure&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;enqueue()&lt;/em&gt;&lt;/strong&gt; − add (store) an item to the queue.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;dequeue()&lt;/em&gt;&lt;/strong&gt; − remove (access) an item from the queue.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;peek()&lt;/em&gt;&lt;/strong&gt; − Gets the element at the front of the queue without removing it.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;isFull()&lt;/em&gt;&lt;/strong&gt; − Checks if the queue is full.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;isEmpty()&lt;/em&gt;&lt;/strong&gt; − Checks if the queue is empty.&lt;/li&gt;
&lt;/ul&gt;

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

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

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

    # Add an element
    def enqueue(self, item):
        self.queue.append(item)

    # Remove an element
    def dequeue(self):
        if len(self.queue) &amp;lt; 1:
            return None

        return self.queue.pop(0)

    # Check the first element in a Queue
    def peek(self):
        if len(self.queue) &amp;lt; 1:
            return None

        return self.queue[0]

    # Check if the Queue is Empty
    def isEmpty(self):
        return len(self.queue) &amp;lt; 1

    # Display  the queue
    def display(self):
        print(self.queue)

    def size(self):
        return len(self.queue)

q = Queue()

q.enqueue(0)
q.enqueue(2)
q.enqueue(0)
q.enqueue(2)
q.enqueue(2)

q.peek()
q.display()

q.dequeue()

print("After removing an element")
q.peek()
q.display()

''' output
0
[0, 2, 0, 2, 2]

After removing an element
2
[2, 0, 2, 2]
'''

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. Linked List
&lt;/h2&gt;

&lt;p&gt;linked list is a linear data structure where data are connected together via links. It consists of nodes where each node contains a data field and a reference(link) to the next node in the list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operations in linked list&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Insertion&lt;/strong&gt; − Adds an element at the beginning of the list.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deletion&lt;/strong&gt; − Deletes an element at the beginning of the list.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Display&lt;/strong&gt; − Displays the complete list.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search&lt;/strong&gt; − Searches an element using the given key.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delete&lt;/strong&gt; − Deletes an element using the given key.
&lt;/li&gt;
&lt;/ul&gt;

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


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

    def listprint(self):
        printval = self.headval
        while printval is not None:
            print (printval.dataval)
            printval = printval.nextval

list = SLinkedList()
list.headval = Node("Mon")
e2 = Node("Tue")
e3 = Node("Wed")

# Link first Node to second node
list.headval.nextval = e2

# Link second Node to third node
e2.nextval = e3

list.listprint()
'''output
Mon
Tue
Wed
'''

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  8. Hash Tables
&lt;/h2&gt;

&lt;p&gt;Hash table is a data structure that implements an associative array abstract data type, a structure that can map keys to values. A hash table uses a hash function to compute an index, also called a hash code, into an array of buckets or slots, from which the desired value can be found.&lt;br&gt;
In a hash table, data is stored in an array format, where each data value has its own unique index value. Access of data becomes very fast if we know the index of the desired data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operations in hash tables&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Search&lt;/strong&gt; − Searches an element in a hash table.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Insert&lt;/strong&gt; − inserts an element in a hash table.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;delete&lt;/strong&gt; − Deletes an element from a hash table. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hashTable = [[],] * 10

def checkPrime(n):
    if n == 1 or n == 0:
        return 0

    for i in range(2, n//2):
        if n % i == 0:
            return 0

    return 1

def getPrime(n):
    if n % 2 == 0:
        n = n + 1

    while not checkPrime(n):
        n += 2

    return n

def hashFunction(key):
    capacity = getPrime(10)
    return key % capacity

def insertData(key, data):
    index = hashFunction(key)
    hashTable[index] = [key, data]

def removeData(key):
    index = hashFunction(key)
    hashTable[index] = 0

insertData(123, "make a circle")
insertData(456, "a big circle")
insertData(789, "like a sufuria")
print(hashTable)

removeData(123)
print(hashTable)

'''output

[[], [], [123, 'make a circle'], [], [], [456, 'a big circle'], [], [], [789, 'like a sufuria'], []]

[[], [], 0, [], [], [456, 'a big circle'], [], [], [789, 'like a sufuria'], []]

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  9. Trees
&lt;/h2&gt;

&lt;p&gt;Tree represents the nodes connected by edges, &lt;strong&gt;Binary tree&lt;/strong&gt; or &lt;strong&gt;binary search tree&lt;/strong&gt; to be specifically. Binary Tree is a special data structure used for data storage purposes. A binary tree has a special condition that each node can have a maximum of two children.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Terms used in Binary Tree.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Path&lt;/strong&gt; − Path refers to the sequence of nodes along the edges of a tree.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Root&lt;/strong&gt; − The node at the top of the tree is called root. There is only one root per tree and one path from the root node to any node.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parent&lt;/strong&gt; − Any node except the root node has one edge upward to a node called parent.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Child&lt;/strong&gt; − The node below a given node connected by its edge downward is called its child node.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Leaf&lt;/strong&gt; − The node which does not have any child node is called the leaf node.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subtree&lt;/strong&gt; − Subtree represents the descendants of a node.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visiting&lt;/strong&gt; − Visiting refers to checking the value of a node when control is on the node.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traversing&lt;/strong&gt; − Traversing means passing through nodes in a specific order.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Levels&lt;/strong&gt; − Level of a node represents the generation of a node. If the root node is at level 0, then its next child node is at level 1, its grandchild is at level 2, and so on.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;keys&lt;/strong&gt; − Key represents a value of a node based on which a search operation is to be carried out for a node. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z_TgtF9V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5cwprrfh9v6a2bp84lk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z_TgtF9V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5cwprrfh9v6a2bp84lk.jpg" alt="Image description" width="600" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operations in Binary Trees&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Insert&lt;/strong&gt; − Inserts an element in a tree/create a tree.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search&lt;/strong&gt; − Searches an element in a tree.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preorder&lt;/strong&gt; Traversal − Traverses a tree in a pre-order manner.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inorder&lt;/strong&gt; Traversal − Traverses a tree in an in-order manner.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Postorder&lt;/strong&gt; Traversal − Traverses a tree in a post-order manner. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  10. Graphs
&lt;/h2&gt;

&lt;p&gt;A graph is a pictorial representation of a set of objects where some pairs of objects are connected by links. The interconnected objects are represented by points termed as vertices, and the links that connect the vertices are called edges.&lt;br&gt;
Formally, a graph is a pair of sets (V, E), where V is the set of vertices and E is the set of edges, connecting the pairs of vertices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Terminologies in Graphs&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Vertex&lt;/strong&gt; − Each node of the graph is represented as a vertex. In the following example, the labeled circle represents vertices. Thus, A to G are vertices. We can represent them using an array as shown in the following image. Here A can be identified by index 0. B can be identified using index 1 and so on.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edge&lt;/strong&gt; − Edge represents a path between two vertices or a line between two vertices. In the following example, the lines from A to B, B to C, and so on represents edges. We can use a two-dimensional array to represent an array as shown in the following image. Here AB can be represented as 1 at row 0, column 1, BC as 1 at row 1, column 2 and so on, keeping other combinations as 0.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adjacency&lt;/strong&gt; − Two node or vertices are adjacent if they are connected to each other through an edge. In the following example, B is adjacent to A, C is adjacent to B, and so on.
&lt;/li&gt;
&lt;li&gt;Path − Path represents a sequence of edges between the two vertices. In the following example, ABCD represents a path from A to D. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bx2UKIKr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/icgfnex3bwgbldfhdajy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bx2UKIKr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/icgfnex3bwgbldfhdajy.jpg" alt="Image description" width="255" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operations in graphs&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Add Vertex&lt;/strong&gt; − Adds a vertex to the graph.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add Edge&lt;/strong&gt; − Adds an edge between the two vertices of the graph.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Display Vertex&lt;/strong&gt; − Displays a vertex of the graph. &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>python</category>
      <category>das</category>
    </item>
    <item>
      <title>Introduction to Modern Python</title>
      <dc:creator>Elkanah Malonza</dc:creator>
      <pubDate>Sat, 12 Feb 2022 19:11:38 +0000</pubDate>
      <link>https://dev.to/malonzaelkanah/introduction-to-modern-python-4peg</link>
      <guid>https://dev.to/malonzaelkanah/introduction-to-modern-python-4peg</guid>
      <description>&lt;p&gt;Python is an interpreted high-level general-purpose programming language. Its a general purpose language meaning it has a range of potential uses like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Web and Internet Development &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Database Access &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Desktop GUIs &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scientific &amp;amp; Numeric &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Education &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Network Programming Software &amp;amp; Game Development &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The advantage of using python programming language compared to other language are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Friendly and easy to Learn&lt;/strong&gt; - Python is an easily readable and simple to understand language for developers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Free&lt;/strong&gt; - Python is developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Highly Compatible&lt;/strong&gt; - python plays well with others and can runs everywhere.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lots of libraries&lt;/strong&gt; - Python's standard library and the community-contributed modules allow for endless possibilities (This is the main reason why I wake, eat, drink, sleep and dream Python everyday). Example NumPy and TensorFlow Python Library is used for everything from data visualization, machine learning, data science, natural language processing, and complex data analysis.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Wide Application&lt;/strong&gt; - we have already mentioned how python is a general purpose language with a wide range of application from web development to scientific applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In this article we are going to cover the basic concepts to get you started with python. We will cover:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;em&gt;Python Expressions&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Data Types&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Variables&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Comments&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Inbuilt Functions&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Putting all together - Your First Python Program&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;1. Python Expressions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A sequence of operands and operators, like&lt;code&gt;x + y - 5&lt;/code&gt;, is called an expression. &lt;code&gt;1 + 2&lt;/code&gt; is called an expression, which is the most basic kind of programming instruction in the language. Expressions  can always evaluate down to a single value.&lt;/p&gt;

&lt;p&gt;Python supports the following operators for combining data objects into expressions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   **  -   Exponent
   %   -   Reminder
   //  -   Integer division/floored quotient ( 22 // 8 = 2)
   /   -   Division (22/8 = 2.75)
   *   -   Multiplication
   +   -   Addition
   -   -   Subtraction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above operators are arranged in their order of operations or precedence which is similar to the order in mathematics. You can use parentheses to override the usual precedence. Examples of expressions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;5 * 2 
5 ** 2 
5 % 2 
5 / 2 
5 // 2 
5+2 
5-2
((1.618034**10)-(1-1.618034)**10)/(5**(1/2)) 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Data Types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A data type is a category for ­values, and every value belongs to exactly one data type. Python data types are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Integers&lt;/strong&gt; - This are values that are whole numbers. Examples: &lt;code&gt;-2 , -1 , 0 , 1 , 2 , 3 , 4 , 5&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Floating-point numbers&lt;/strong&gt; - this are numbers with a decimal point. Example: &lt;code&gt;3.142,  1.25 , -1.0 , ‐ -0.5 , 0.0 , 0.5 , 1.0 , 1.25&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strings&lt;/strong&gt; - This are text values, defined by surrounding your string in single quote. Examples: &lt;code&gt;'a' , 'aa' , 'aaa' , 'Hello!' , '11 cats'&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Variables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Variables are used to store information to be referenced and manipulated in a computer program. You’ll store values in variables with an assignment statement which consists of a variable name, an equal sign (assignment operator) and the value to be stored. In &lt;code&gt;buffer = 54&lt;/code&gt;, then a variable named buffer will have the integer value 54 stored in it. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data = 53 # initializing a variable
buffer = 62
buffer = 37 # overwriting the variable
data = buffer + data # they can be used with expression
name = 'malonza' # a variable holding strings
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A variable name can be of any length as long as they follow the following rules:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It can be only one word.&lt;/li&gt;
&lt;li&gt;It can use only letters, numbers, and the underscore ( _ ) character.&lt;/li&gt;
&lt;li&gt;It can’t begin with a number.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a = 23 # valid

 _name = 'john' # valid

zoo3 = 'lazy' # valid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Python Comments&lt;/strong&gt;&lt;br&gt;
Python ignores comments when the code is executed, and you can use them to write notes or remind yourself what the code is trying to do.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Any text for the rest of the line following a hash mark ( # ) is part of a comment.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Program to add two numbers
x, y = 2, 3
x+y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Using 3 single quotes at the beginning and end of a block of text make the text a comment.This style of commenting your code can transverse multiple line unlike using the hash(#).
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;''' 
A Random text with
multiple lines to show you how to add
comment in multiple line of code
'''
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;5. Built-in Function&lt;/strong&gt;&lt;br&gt;
A &lt;strong&gt;function&lt;/strong&gt; is a block of organized, reusable code that is used to perform a single, related action.&lt;br&gt;
A &lt;strong&gt;built-in function&lt;/strong&gt; is a function  that is provided as part of a high-level language (python in this instance) and can be executed by a simple reference with specification of arguments.&lt;br&gt;
&lt;em&gt;The print() Function&lt;/em&gt;&lt;br&gt;
The print() function displays the string value inside the parentheses on the screen. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello World!")
name = 'Malonza '
print(name)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;The input() Function&lt;/em&gt;&lt;br&gt;
The input() function waits for the user to type some text on the keyboard and press enter.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;The len() Function&lt;/em&gt;&lt;br&gt;
You can pass the len() function a string value (or a variable containing astring), and the function evaluates to the integer value of the number of characters in that string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;names = "Elkanah Malonza"
len(name)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;The str(), int(), and float() Functions&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The str() , int() , and float() functions will evaluate to the string, integer, and floating-point forms of the value you pass, respectively.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;str(0)
'0'
str(-3.14)
'-3.14'
int('42')
42
int('-99')
-99
int(1.25)
1
int(1.99)
1
float('3.14')
3.14
float(10)
10.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. Putting all together - Your First Python Program&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now it’s time to create your first program!&lt;/p&gt;

&lt;p&gt;Open a file/text editor such as Notepad or sublime text and type the following into it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = input("What is your Name: ")
print("Wow!, You name is ", len(name), "Long.")
dob = int(input("When were you born", name, ": ")) # the int() function to convert the input() value to integer
age = 2019 - dob
print("You are ", age, "years old.")
print("THanks ", name, "for choosing Python3.")
print("Bye!")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you’ve entered your source code, save it as &lt;code&gt;hello.py&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;open a Terminal or command line interface and move to the &lt;code&gt;hello.py&lt;/code&gt; file location using cd command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd [path_to_the_file_location]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To run or execute the file type the following command and press enter:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;python3 hello.py&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;em&gt;HAPPY CODING!!&lt;/em&gt;&lt;/p&gt;

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