<?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: Aderibigbe Samuel</title>
    <description>The latest articles on DEV Community by Aderibigbe Samuel (@savviesammie).</description>
    <link>https://dev.to/savviesammie</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%2F814313%2F2bc59905-4e9a-4bba-ada1-cc2e5f1457f4.JPG</url>
      <title>DEV Community: Aderibigbe Samuel</title>
      <link>https://dev.to/savviesammie</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/savviesammie"/>
    <language>en</language>
    <item>
      <title>Automate Your Code Reviews With AI: CodiumAI vs Github Copilot</title>
      <dc:creator>Aderibigbe Samuel</dc:creator>
      <pubDate>Fri, 08 Dec 2023 14:38:21 +0000</pubDate>
      <link>https://dev.to/savviesammie/automate-your-code-reviews-with-ai-codiumai-vs-github-copilot-2hci</link>
      <guid>https://dev.to/savviesammie/automate-your-code-reviews-with-ai-codiumai-vs-github-copilot-2hci</guid>
      <description>&lt;p&gt;Have you ever found yourself struggling to remember the modifications you made to a forked project? Maybe the changes were extensive, and despite your efforts, you worry that you might have missed capturing all the details in the pull request comment. Or perhaps you've been reviewing changes in a codebase and felt lost because the contributors didn't provide sufficient context for their modifications. In this post, I will demonstrate an AI tool that can help you review PRs more quickly and effectively.&lt;/p&gt;

&lt;p&gt;In the world of software development, Code reviews are not just a checkbox or an unpleasant routine to add more work, they are important to maintain a quality, reliable, and consistent codebase especially when working as a team. Imagine you just built an app to power the next big thing, picture this without a code review, it's like an artist sending a masterpiece into the hands of users without a final polish, a spellcheck, or a friendly critique. It might work, but chances are, there could be a hidden bug, or even a potential failure waiting to happen.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pull Request
&lt;/h3&gt;

&lt;p&gt;A pull request is used in version control systems such as Git to propose changes to a codebase. A Developer working on a local branch of a codebase, implementing new features, fixing bugs, or making improvements, will need to make a pull request to merge those changes into the main or target branch, including a comment to provide context.&lt;br&gt;
This pull request now becomes the focal point for code reviews. The good news is that there are AI tools that can assist you in reviewing PRs more quickly and efficiently.&lt;/p&gt;
&lt;h3&gt;
  
  
  CodiumAI PR_Agent Vs GitHub Copilot
&lt;/h3&gt;

&lt;p&gt;We've seen the use of AI in virtually everything in the tech space, with the rise of GPT, a lot of solutions to everyday problems are been made.CodiumAI is one of the interesting solutions that caught a lot of developers' attention and I will be comparing its features with Github Copilot helping you choose the right tool for your next pull request.&lt;/p&gt;
&lt;h3&gt;
  
  
  What is CodiumAI's PR-Agent?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7zyhowbb79izy9rpdall.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7zyhowbb79izy9rpdall.png" alt="CodiumAI's PR-Agent Website"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CodiumAI has developed a powerful tool, known as PR-Agent, designed to assist developers in speeding up and enhancing the efficiency of their pull request (PR) reviews. This AI agent automatically scrutinizes the commits and the PR itself, offering various types of valuable feedback:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Auto-Description&lt;/strong&gt;: Automatically generates a PR description, including details such as the name, type, summary, and a walkthrough of the code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PR Review&lt;/strong&gt;: Provides feedback on the main theme of the PR, its type, relevant tests, potential security issues, and other suggestions to improve the PR content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Question Answering&lt;/strong&gt;: Capable of answering free-text questions related to the PR, offering insights and information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Suggestion&lt;/strong&gt;: Offers committable code suggestions aimed at enhancing the overall integrity of the PR, from bug identification to providing meaningful tests.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu3st2rk0zxlzxm8zlng9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu3st2rk0zxlzxm8zlng9.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The interesting thing about this tool is that &lt;strong&gt;it's free, it's open-sourced, it supports six command prompts and it supports all git environments!&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Github Copilot for Pull Requests
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ierawb9granlmdigwyk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ierawb9granlmdigwyk.png" alt="screenshot from https://github.com/features/copilot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GitHub Copilot's pull request summaries, an AI-powered feature, empower users to craft a comprehensive overview of changes in a pull request. This includes detailing the impacted files and guiding reviewers on key focus areas during the review process.&lt;/p&gt;

&lt;p&gt;Upon a user's request for a summary, Copilot meticulously scans the pull request. It presents an overview of the changes in a narrative format, supplemented by a concise, bulleted list specifying the changes and their respective impacted files.&lt;/p&gt;

&lt;p&gt;Leverage GitHub Copilot seamlessly to generate pull request summaries directly on GitHub.com. This functionality serves a dual purpose—assisting reviewers in understanding modifications and providing a quick grasp for users conducting a pull request review.&lt;/p&gt;

&lt;p&gt;GitHub Copilot's analysis of the pull request ensures a detailed overview in narrative form and a succinct, bulleted list outlining changes and their impacted files. This summary feature is conveniently accessible in various locations, offering flexibility in its utilization.&lt;/p&gt;
&lt;h3&gt;
  
  
  Feature-by-Feature Comparison
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;CodiumAI's PR Agent&lt;/th&gt;
&lt;th&gt;GitHub Copilot&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Price💰&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;free&lt;/strong&gt; for individual developers.&lt;/td&gt;
&lt;td&gt;Paid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open-source&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No of commands&lt;/td&gt;
&lt;td&gt;Multiple🚀&lt;/td&gt;
&lt;td&gt;One1️⃣&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Git Platform Supported&lt;/td&gt;
&lt;td&gt;All Git platforms✅&lt;/td&gt;
&lt;td&gt;Only Github1️⃣&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Supported Languages&lt;/td&gt;
&lt;td&gt;all major programming languages ✅&lt;/td&gt;
&lt;td&gt;all major programming languages✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Supported IDEs&lt;/td&gt;
&lt;td&gt;VS Code, JetBrains IDEs, Vim&lt;/td&gt;
&lt;td&gt;Neovim, JetBrains IDEs, VS Code, Azure Data Studio&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Code Analysis&lt;/td&gt;
&lt;td&gt;Yes✅&lt;/td&gt;
&lt;td&gt;Yes✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No of features&lt;/td&gt;
&lt;td&gt;Multiple🚀&lt;/td&gt;
&lt;td&gt;One1️⃣&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Real-world Use Cases
&lt;/h2&gt;

&lt;p&gt;Currently, Copilot Pull request summaries is in beta and is only available to a limited number of users, however, I would what I found on their website.&lt;/p&gt;
&lt;h3&gt;
  
  
  CodiumAI's PR-Agent
&lt;/h3&gt;

&lt;p&gt;Picture this: we're a dynamic team on a mission to fortify our website with an impenetrable password validator. We're tasked with crafting a program that takes a string as input and decides if it's a rock-solid password. Now, what makes a password truly formidable? Well, we've set some ground rules: it should boast a minimum of 2 numbers, 2 special characters from the elite squad ('!', '@', '#', '$', '%', '&amp;amp;', '*'), and a length of at least 7 characters. If a password passes this litmus test, it earns the prestigious title of 'Strong'; otherwise, it's dubbed 'Weak.'&lt;/p&gt;

&lt;p&gt;Let see our eager junior dev, who dives straight into the code fray with this valiant attempt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;num_count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="n"&gt;char_count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="n"&gt;char&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;#&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;$&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;nums&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;3&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;4&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;5&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;6&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;7&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;8&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;9&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;char_count&lt;/span&gt;  &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;num_count&lt;/span&gt;  &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;


&lt;span class="nf"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;char_count&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;num_count&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Strong&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Weak&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bravo, right? Well, not quite. There's a little hiccup. The code's loyalty to the "in" operator is a bit too exclusive—it checks only one value in a sequence and refuses to mingle with "and" to check multiple values.&lt;/p&gt;

&lt;p&gt;But fear not! Another team member, ever watchful for such nuances, stepped in, wrote a test code to unveil the error, and gracefully submitted a pull request. let's see PR-Agent in play:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkqlgnhe8usepc028tezv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkqlgnhe8usepc028tezv.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One good aspect of the PR-Agent tool is its user-friendly nature. To initiate any command, simply tag @CodiumAI-Agent and choose from the available commands: /describe, /review, /improve, or /ask. Let's kick things off with a review:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4lupogmhuv4rki2be67x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4lupogmhuv4rki2be67x.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcm8ofy0nnuqzk692ot7j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcm8ofy0nnuqzk692ot7j.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is incredible! CodiumAI's PR_Agent provided a thorough review, giving the team a clear understanding of the situation.&lt;/p&gt;

&lt;p&gt;Imagine the possibilities if we could engage PR-Agent to assist us with addressing the issues. This versatile tool not only helps in crafting detailed summaries but can also contribute to code improvements. All it takes is a simple comment to tap into its capabilities, Let's ask for help with improving the code:&lt;/p&gt;

&lt;p&gt;"@CodiumAI-Agent /improve --pr_code_suggestions.extra_instructions="make the code a function and correct the validator's logic"&lt;/p&gt;

&lt;p&gt;I've just tagged the PR-Agent tool, issued a command to enhance the code, and included specific instructions to turn it into a function and rectify the logic. I'm simply delegating all the work to PR_Agent. Check this out—it's pretty cool!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1i8i5zenhtg8t4rcr83z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1i8i5zenhtg8t4rcr83z.png" alt="asking PR_Agent to help improve"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6hzqgtwpyuthslql0h5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn6hzqgtwpyuthslql0h5.png" alt="PR-Agent response"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjg0r0jz4j3w3bf7fm209.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjg0r0jz4j3w3bf7fm209.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnxjp67pgs99teskuuphm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnxjp67pgs99teskuuphm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not only have I saved time by avoiding the need to explain my actions in a comment, but now I also have a tool that can assist me in refining my code on the fly.&lt;/p&gt;

&lt;p&gt;Let's ask PR_Agent to help us with naming the file, considering that well-chosen filenames can greatly enhance context:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F42f5ebefjt9au5cxqhqo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F42f5ebefjt9au5cxqhqo.png" alt="aking PR-Agent to name file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F238phbqpls0cwubp88ld.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F238phbqpls0cwubp88ld.png" alt="PR-Agent Response"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub Copilot
&lt;/h3&gt;

&lt;p&gt;Currently, the GitHub Copilot Pull request summary is in beta and is only available to a limited number of users, however, I have read through their docs and I will share the capabilities available with the tool.&lt;br&gt;
Sure, let's break it down:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Start on GitHub:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to GitHub.com, where you can manage and collaborate on your code.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create or Open a Pull Request:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you're making a new set of changes, create a pull request. If there's already one in progress, find and open it.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Blank Description is Best:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make sure the description of your pull request is blank. GitHub Copilot works best when starting with a clean slate.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Find the Summary Field:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Locate the place where you want to add a summary. This could be in the description when creating a new pull request, in the opening comment of an existing one, or as a separate comment at the bottom of the pull request page.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Adding a Summary:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the field where you're typing, look for options at the top. Find the one that looks like a bullet point, and click on it. This is where you'll find the option to add a summary.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3norxcy7psaxjm8nbc4j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3norxcy7psaxjm8nbc4j.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
.&lt;br&gt;
It's important for users participating in a beta to be aware that the feature may still have some rough edges, and unexpected issues may arise. Beta testing is a collaborative effort between developers and users to refine and polish a feature before it reaches the broader user community in a stable and fully released version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which tool is best for me?
&lt;/h2&gt;

&lt;p&gt;The choice of the right tool depends on various factors mentioned in the post. Considerations such as pricing preference, whether for a paid or free tool, play a role. While some may lean towards open-source tools, it's essential to evaluate specific features. Open-source tools, like the ones I prefer, offer accessibility to the source code, fostering transparency and community collaboration. This approach allows for code review, audits, and suggested improvements, expediting the identification and resolution of security vulnerabilities.&lt;/p&gt;

&lt;p&gt;Another aspect to ponder is the range of supported commands in both tools. If you only need a bulleted list of changes, GitHub Copilot could be a suitable choice. However, if you require additional features like assistance in improving your work or seeking guidance through an 'AI Assistant' for specific code aspects, PR-Agent may be more suitable.&lt;/p&gt;

&lt;p&gt;PR-Agent provides developers and repository maintainers with valuable information, streamlining the PR approval process. It also offers actionable code suggestions to enhance the quality of the PR. This integrated approach allows developers to assess the impact of their work without leaving their preferred Git provider environment, whether it's GitHub, GitLab, or another platform.&lt;/p&gt;

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

&lt;p&gt;Deciding among these tools depends on what you need, what your project aims to achieve, and what you like. Whether opting for the collaborative power of open source or the concise capabilities of a dedicated code summarization tool, there are now different options to make coding even better. The important thing is to adapt to new tools that fit your project and team well. Whether you lean towards the detailed insights of PR-Agent or the succinct summaries of GitHub Copilot, the overarching goal remains the same: to help developers and make reviewing code together easier and more effective.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>BIG O Notation: A Quick Introduction</title>
      <dc:creator>Aderibigbe Samuel</dc:creator>
      <pubDate>Tue, 04 Jul 2023 16:44:13 +0000</pubDate>
      <link>https://dev.to/savviesammie/big-o-notation-a-quick-introduction-382l</link>
      <guid>https://dev.to/savviesammie/big-o-notation-a-quick-introduction-382l</guid>
      <description>&lt;p&gt;When approaching problems in coding, we often come up with an algorithm, which is a set of instructions for solving a problem. To make you understand algorithms, Imagine you have a bunch of unsorted numbers, and you want to find the largest number among them. Here's a straightforward algorithm to solve this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start with the first number in the list and call it the "current largest number."&lt;/li&gt;
&lt;li&gt;Compare the "current largest number" to the next number in the list.&lt;/li&gt;
&lt;li&gt;If the next number is larger than the "current largest number," update the "current largest number" to be the next number.&lt;/li&gt;
&lt;li&gt;Move to the next number in the list and repeat steps 2 and 3 until you have compared all the numbers.&lt;/li&gt;
&lt;li&gt;At the end, the "current largest number" will be the largest number in the list.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There you have it! a simple algorithm to solve the problem. some algorithms are faster and more efficient than others, especially when dealing with large amounts of data. Consider that there are two ways to arrange a stack of papers. One approach is to examine each paper individually, compare them, and rearrange them until they are in the correct order. The alternative procedure entails cutting the pile in half, sorting each half independently, and then combining them. Which approach do you believe would proceed more quickly as the pile gets bigger? We can respond to questions like these using Big O notation. It enables us to gauge how an algorithm's resource or time requirements change with the size of the input. You can select the right algorithms for various tasks by having a solid understanding of the Big O notation.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Big O?
&lt;/h3&gt;

&lt;p&gt;Big O is a way to measure the efficiency of an algorithm or the speed at which it runs, it helps us understand how the algorithm's performance changes as the amount of data it handles grows.  &lt;/p&gt;

&lt;p&gt;Oftentimes, interviewers would ask questions about big o or ask you to write codes and then evaluate how fast or efficient is your code. &lt;/p&gt;

&lt;h3&gt;
  
  
  Time Complexity vs Space Complexity
&lt;/h3&gt;

&lt;p&gt;Let's say you have a stopwatch and you have written two codes, Code A and Code B.  If you run code A and start the stopwatch and it took 20 seconds for code A to run, you reset the stopwatch and you run code B and it took 40 seconds for code B to run, based on this you would say code A runs faster than code B that is, you can measure it, This is called &lt;strong&gt;Time Complexity&lt;/strong&gt; . A very interesting yet confusing thing about Time complexity is that it is not measured in time but in number of operations that it takes to complete a task. Imagine you took code B(from the example above) and run it on a computer have a processor thrice as fast, it will complete before code A but it does not mean the code B is faster or more efficient, it just means the computer is better, so we use the number of operations instead of time to evaluate Time Complexity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Space Complexity&lt;/strong&gt; on the other hand, refers to the amount of memory or storage space an algorithm requires to solve a problem. It measures how the memory usage of an algorithm changes with the size of the input.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;why is space complexity also important?&lt;/strong&gt;  we mostly prioritize speed when writing codes but why do we need to consider space complexity too? &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--doE7NHDE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/su9aqkbrorta3a9etotd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--doE7NHDE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/su9aqkbrorta3a9etotd.png" alt="Image description" width="800" height="640"&gt;&lt;/a&gt;&lt;br&gt;
Again from the comparison between code A and code B, let's say, while code A runs faster,  it requires more memory space but code B requires less memory space even though it runs slower. There will be some occasions when memory space will need to be considered, so it is important to consider space complexity too while writing codes. &lt;/p&gt;
&lt;h3&gt;
  
  
  Big O (O), Omega (Ω) and Theta (Θ)
&lt;/h3&gt;

&lt;p&gt;These are the commonly used notations in time and space complexity and they represent the following:&lt;br&gt;
&lt;strong&gt;Big O (O):&lt;/strong&gt; The Big O notation represents the upper bound or worst-case scenario of an algorithm's time or space complexity.&lt;br&gt;
&lt;strong&gt;Omega (Ω):&lt;/strong&gt; The Omega notation represents the lower bound or best-case scenario of an algorithm's time or space complexity.&lt;br&gt;
&lt;strong&gt;Theta (Θ):&lt;/strong&gt; The Theta notation represents both the upper and lower bounds of an algorithm's time or space complexity.&lt;/p&gt;

&lt;p&gt;The way I like to think of these notations is having a list of seven items and I write a for loop to iterate through these items to find a particular one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D5qfZ1oe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kj89unawbpcqp4nu4e12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D5qfZ1oe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kj89unawbpcqp4nu4e12.png" alt="Image description" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let say you are looking the number 1, that is your best-case scenario (Omega (Ω)) because you will get the first item in the list in just one operation but if you want to get the number, 7, that is your worst-case scenario (O) because 7 is the last item in the list and you have to go through the entire list to get through it. To get number 4, that's your average-case (Theta (Θ)) because it's between your best-case and worst-case. &lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Common Time complexities&lt;/strong&gt;
&lt;/h3&gt;
&lt;h3&gt;
  
  
  O(n):
&lt;/h3&gt;

&lt;p&gt;This is the simplest to understand. Consider being tasked with counting the oranges in a basket. Let's say you count the 10 oranges you have one by one. You need 10 units of time or effort to finish the job. Now, if you had 20 oranges instead of 10, it will roughly take you twice as long or as much work to count them.&lt;/p&gt;

&lt;p&gt;O(n), where "n" stands for the input size, is a mathematical representation of this linear relationship. It shows that the time or effort needed to complete the activity rises at the same rate as the input size (number of oranges). It takes about twice as much time or effort if you have two times as many oranges.&lt;/p&gt;

&lt;p&gt;A simple code example of this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;print_items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;print_items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;0
1
2
3
4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code printed five (5) items because we passed the argument n = 5, so it took 5 units of effort to get the task done, so whatever n was, that would be the number of operations. It means that the time it takes to complete an algorithm or operation increases linearly with the size of input.&lt;br&gt;
let's look at the graph of O(n):&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PC15qPgN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xh7l4o4h4hnprdvazspw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PC15qPgN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xh7l4o4h4hnprdvazspw.png" alt="Image description" width="800" height="640"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  O(n^2):
&lt;/h3&gt;

&lt;p&gt;In simple terms, O(n^2) means that the time or space complexity of an algorithm grows quadratically with the input size. To illustrate this with a code, let's write a 'for loop' inside another 'for loop'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;print_items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;



&lt;span class="n"&gt;print_items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;0 0
0 1
0 2
0 3
0 4
1 0
1 1
1 2
1 3
1 4
2 0
2 1
2 2
2 3
2 4
3 0
3 1
3 2
3 3
3 4
4 0
4 1
4 2
4 3
4 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;so from 0,0 to 4,4 we have 25 items printed, the input size n = 5 but we got n * n = n^2 items printed which is 25, hence illutrating the quadratic relationship. 'for loop' inside another 'for loop'is a good example of O(n^2)&lt;br&gt;
The graph:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MJt_4Caa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6enfv26jzdm55m9umlp1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MJt_4Caa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6enfv26jzdm55m9umlp1.png" alt="Image description" width="800" height="640"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  0(1):
&lt;/h3&gt;

&lt;p&gt;O(1) means that the time or space complexity of an algorithm remains constant regardless of the input size. This constant relationship is represented by O(1), also known as "constant time complexity." It means that the time or effort required to perform the task remains the same, regardless of the input size. Addition of the same number is an example of this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_num&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;

&lt;span class="n"&gt;add_num&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="n"&gt;add_num&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;2

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

&lt;/div&gt;



&lt;p&gt;The other operations we've seen, as the input size increase, so does the number of operations but this constant time complexity is different. even if n = 100000000, there's just one operation to be done i.e, n + n = 100000000 + 100000000 = 200000000 and that is o(1), the constant time. &lt;br&gt;
on the graph:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RhMRvLKH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hfq7d4yw7z7ebr0nthkq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RhMRvLKH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hfq7d4yw7z7ebr0nthkq.png" alt="Image description" width="800" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;o(1) is represented by the horizontal blue line on the graph and this is the most efficient of big O, anytime you can optimize your code to O(1), that is the most efficient you can have it.&lt;/p&gt;
&lt;h3&gt;
  
  
  o(logn)
&lt;/h3&gt;

&lt;p&gt;O(log n) indicates that an algorithm's time or space complexity increases logarithmically as the amount of the input increases.&lt;/p&gt;

&lt;p&gt;Let's use the example of looking up a word in a dictionary to further comprehend this. Instead of starting from the first page and flipping through each page one by one, you can use a more efficient strategy. You might open the dictionary roughly in the middle and check if the word you're looking for comes before or after that page. Based on the result, you can eliminate half of the remaining pages and repeat the process. You may easily zero in on the place by repeatedly 'halfing' the search area.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;O(log n)&lt;/strong&gt;, where "n" is the input size, represents this logarithmic relationship. It means that the task's time or effort requirements rise, but not proportionally, as the size of the input expands. As an alternative, it rises logarithmically. Let's write a traditional binary search in python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;binary_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;low&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;high&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;low&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;low&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;  &lt;span class="c1"&gt;# Find the middle index
&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="c1"&gt;# if the the middle element is the target
&lt;/span&gt;            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="c1"&gt;# If the target is greater, search the right half
&lt;/span&gt;            &lt;span class="n"&gt;low&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="c1"&gt;# If the target is smaller, search the left half
&lt;/span&gt;            &lt;span class="n"&gt;high&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;  &lt;span class="c1"&gt;# Target not found
&lt;/span&gt;
&lt;span class="c1"&gt;# Example usage
&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;36&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;binary_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Target found at index"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Target not found"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The binary_search function in this code runs an O(log n)-time complicated binary search on a sorted list. The search space is divided in half repeatedly until the target element is located or the search space is used up.&lt;/p&gt;

&lt;p&gt;The input parameters for the function are an array (arr) and a target value (target). Two pointers, low and high, are initialized to maintain track of the search range. It determines the middle index (mid) and compares the middle element with the desired value within the while loop. It updates the low and high search parameters in accordance with the comparison. It returns the index if the target can be found; else, it gives -1 to show that the target is not in the array.&lt;br&gt;
The binary search algorithm exhibits the O(log n) time complexity property in that the number of iterations grows logarithmically as the size of the list increases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Even if you are not preparing for an interview but you are interested in developing effective code, learning Big O notation is very helpful. Big O notation enables you to comprehend algorithm efficiency, make wiser software development decisions, and interact with other developers. It is a helpful tool for increasing performance and developing software that is more effective.&lt;/p&gt;

&lt;p&gt;I published an article detailing how I used Python to solve the LeetCode challenge "Two Sum". I came up with two methods, the first of which was my first strategy. I was simply interested in getting the code to function; I didn't care about how much space it took up or how quickly it ran. By using my understanding of Big O, I was able to create a second, more effective approach. The article is accessible here. &lt;a href="https://dev.to/savviesammie/two-sum-leetcode-problem-1-solution-in-python-4al9"&gt;Two Sum - LeetCode problem 1 solution in python &lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;here's also &lt;a href="https://www.bigocheatsheet.com/"&gt;Big O cheatsheet&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;say hi to me on Twitter &lt;a href="https://twitter.com/Sammie_savvie"&gt;@Sammie_savvie&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>datastructures</category>
      <category>algorithms</category>
      <category>interview</category>
    </item>
    <item>
      <title>How I solved an ImportError Issue in Django</title>
      <dc:creator>Aderibigbe Samuel</dc:creator>
      <pubDate>Fri, 09 Jun 2023 00:45:11 +0000</pubDate>
      <link>https://dev.to/savviesammie/how-i-solved-an-importerror-issue-in-django-385n</link>
      <guid>https://dev.to/savviesammie/how-i-solved-an-importerror-issue-in-django-385n</guid>
      <description>&lt;p&gt;I was trying to create a URL shortener app in Django. So, I started with the basic setup. However, when I attempted to start a new project using the command "django-admin startproject ", I encountered an error message: "ImportError: cannot import name 'Iterator' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/init.py)".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw3u3zumk2l74tk54hoqs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw3u3zumk2l74tk54hoqs.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the error message, it is obvious that there is something wrong with importing the Iterator class from the collections module.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the Iterator class&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Python, the Iterator class is a built-in class that represents an iterator object. An iterator is an object that implements the iterator protocol, which consists of two methods: &lt;strong&gt;iter&lt;/strong&gt;() and &lt;strong&gt;next&lt;/strong&gt;().&lt;/p&gt;

&lt;p&gt;An iterator is a Python object that facilitates iterating through a group of things one at a time. Consider it a means to perform a specified action on each item in a collection or access them all at once.&lt;br&gt;
Python comes with a built-in class called Iterator that gives you the ability to make your own unique iterators. Two unique methods, &lt;strong&gt;iter&lt;/strong&gt;() and &lt;strong&gt;next&lt;/strong&gt;(), create a set of rules that an iterator must abide by.&lt;/p&gt;

&lt;p&gt;The iterator's beginning is similar to the procedure &lt;strong&gt;iter&lt;/strong&gt;(). It gets the iterator ready to start the iteration process or restart it.&lt;br&gt;
The next item is obtained from the iterator using the &lt;strong&gt;next&lt;/strong&gt;() method. It hands you the current item before moving on to the following one. It notifies you if there are no more items by raising a unique signal known as the StopIteration exception.&lt;br&gt;
You can specify how you wish to iterate over a collection of things or include your own custom logic by building your own iterator. An iterator could, for instance, count from 0 to a specified number, carry out certain operations on each item, or iterate over your own unique objects.&lt;/p&gt;

&lt;p&gt;Here is a straightforward illustration of how an iterator functions:&lt;/p&gt;

&lt;p&gt;Consider that you wish to examine each marble in your bag of colorful marbles one by one. You could accomplish it with the iterator. When you request the marble, it gives it to you while keeping track of the existing marble. When you reach the last marble, it tells you that there are no more marbles left.&lt;br&gt;
An example of a custom iterator that counts from 0 to a specified number: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyIterator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_num&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;max_num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;max_num&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__iter__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__next__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;current&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;max_num&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;current&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;current&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;StopIteration&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;To use the custom Iterator,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;

&lt;span class="n"&gt;my_iterator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;MyIterator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;my_iterator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Understanding iterators will allow you to use them with loops, such as for loops, to quickly iterate across collections of things. Additionally, a lot of Python objects, including lists, strings, and dictionaries, are already iterable, which means you can use an iterator with them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;so, back to the error&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I did a little research online and I got to know that this error is usually encountered when using Python 3.10 or higher, as the Iterator class was moved to a different location in the Python standard library starting from Python 3.10.&lt;/p&gt;

&lt;p&gt;You can fix this problem by changing the import statement in your Django project's source code. What you can do is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Find the file containing the problematic import statement. /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/&lt;strong&gt;init&lt;/strong&gt;.py, an internal Python library file that is generally not a file you would edit, is mentioned in the error message.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3yolwud9h6cacnsg86kq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3yolwud9h6cacnsg86kq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the error-related file or any other file in your project that makes use of the collections.Iterator import.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Finhskh41b9h4o7oz49t2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Finhskh41b9h4o7oz49t2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To import Iterator from the proper location, modify the import statement. Import it from collections.abc rather than from collections. Substitute the following import statement for the current one:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;collections.abc&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Iterator&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx25861ju50dwapg3plie.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx25861ju50dwapg3plie.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Save the file and try running your Django project again. The error should no longer occur.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You may ensure compatibility with Python 3.10 and later versions, where the Iterator class was moved to the collections.abc module, by importing Iterator from collections.abc rather than collections.&lt;/p&gt;

&lt;p&gt;Now if I type django-admin startproject  in my terminal, There will be no more error and the code works&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8cxnmfasgvwdptr6obxn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8cxnmfasgvwdptr6obxn.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;when I open my text editor, the project is now created&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb5zgqunbllwrjh1y71rm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb5zgqunbllwrjh1y71rm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A less nerdy method to solve this same problem is to:&lt;/p&gt;

&lt;p&gt;Verify Django version compatibility: Make sure the Django version you're running is compatible with the Python version you have installed. To figure out which version to use, look over the Django documentation or the project requirements.&lt;/p&gt;

&lt;p&gt;Run the following command in your terminal to verify the version of Python you have installed:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;python --version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Update Django: If the problem still exists even though you are using the right version of Python, try updating your Django installation to the most recent version that is compatible. To update Django, use the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pip install --upgrade django&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now you can try creating the django project again and it will run without any error.&lt;/p&gt;

&lt;p&gt;Thanks for reading,&lt;/p&gt;

&lt;p&gt;say hi to me on &lt;a href="https://twitter.com/Sammie_savvie" rel="noopener noreferrer"&gt;twitter @Sammie_savvie&lt;/a&gt;&lt;/p&gt;

</description>
      <category>django</category>
      <category>bug</category>
      <category>python</category>
    </item>
    <item>
      <title>Linux terminal for beginners - A quick guide</title>
      <dc:creator>Aderibigbe Samuel</dc:creator>
      <pubDate>Tue, 23 May 2023 18:27:38 +0000</pubDate>
      <link>https://dev.to/savviesammie/linux-terminal-for-beginners-a-quick-guide-2jk2</link>
      <guid>https://dev.to/savviesammie/linux-terminal-for-beginners-a-quick-guide-2jk2</guid>
      <description>&lt;p&gt;Do you know that there was a time when computers only display texts and the only input device to tell the computer what to do was the keyboard? Yeah, computers were used by the few who understood how to input commands and then interpret the text information displayed on the computer screen. Here was the workflow, users could only interact with the command line by typing text-based commands and an action is performed or a text information is displayed. Back then, users had to be very careful with typing commands because one wrong command can perform an unwanted action or delete a file or even close the command line program. So the use of computer was limited in a way until the invention of mouse in 1964 and Ivan Sutherland's invention of a computer program called sketchpad which was regarded as the first Graphical User Interface program. Graphical User Interface &lt;strong&gt;GUI&lt;/strong&gt; makes use of graphical icons and audios to help users interact well with the computer.&lt;/p&gt;

&lt;p&gt;when you want to open your browser, you would click on the browser icon with your mouse or trackpad on your pc, right? But you could do the same on your command line by typing some texts. let's say I want to open safari (a web browser) from the command line, I will type the following texts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;open -a safari
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, which is easier? clicking icon or typing texts? yeah, it's straight forward &lt;strong&gt;GUI&lt;/strong&gt; is easier but not necessarily faster. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shell&lt;/strong&gt; while &lt;strong&gt;GUI&lt;/strong&gt; and Command line interface(&lt;strong&gt;CLI&lt;/strong&gt;) are the ways we can the interact with the computer, Shell is really the program responsible for helping the operating system understand the commands. you would hear words like Window shell and &lt;strong&gt;Bash&lt;/strong&gt; (Bourne Again Shell). BASH Linux is very popular because it's open source and free. Windows operating system comes with it's own shell called windows shell but you can also install Linux on Windows, &lt;a href="https://learn.microsoft.com/en-us/windows/wsl/install" rel="noopener noreferrer"&gt;click here on how to install linux on windows&lt;br&gt;&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's learn how to perform some operations using Linux commands&lt;/p&gt;

&lt;p&gt;Windows users: Open PowerShell or Windows Command Prompt&lt;br&gt;
Mac Users: Open the Terminal app&lt;/p&gt;

&lt;p&gt;Here are some of the frequently used commands:&lt;br&gt;
• cd (change down a directory)&lt;br&gt;
• mkdir (make directory)&lt;br&gt;
• cd .. (change up a directory)&lt;br&gt;
• ls (list files in your current directory)&lt;br&gt;
• pwd (print working directory)&lt;br&gt;
• touch (create a new file)&lt;/p&gt;

&lt;p&gt;Making a directory &lt;strong&gt;mkdir&lt;/strong&gt; : &lt;br&gt;
I'm sure on your desktop you have some folders and inside those folders you have kept some files there. Making a directory is doing the same thing, so for the purpose of this tutorial think of making directories and creating folders (even though a directory is different from a folder). The first thing you would determine is the location to create your folder, maybe on desktop, downloads or even inside another folder. Let's say I want to create a directory(folder) on my desktop, so the desktop is the &lt;strong&gt;location&lt;/strong&gt; I want to keep the folder. First thing is to navigate to the location by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; cd ~/desktop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So I have navigated into my desktop location, I can then create the directory, let's assume the directory name is "projects", I will use the &lt;strong&gt;mkdir&lt;/strong&gt; command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; mkdir projects
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you correctly typed this command, you wouldn't see anything change but if you minimize your powershell or terminal and go to your desktop, you will see a folder called "projects" created.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create Files inside a Folder:&lt;/strong&gt;&lt;br&gt;
Imagine you need to create a file in a folder, remember we've created directory called projects? now, let's create a file say "homepage.html" (the .html is the file extension for html documents). first navigate into the "projects" directory which is the location where you want to store your file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; cd projects
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we've changed our directory from "desktop" to "projects", we can then create the file by using the touch command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch homepage.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;again, if you go on your  desktop and open the "projets" folder, you will see a file named "homepage.html". Notice how we navigated from desktop → projects, usually if you are using a &lt;strong&gt;GUI&lt;/strong&gt; you can easily see which location you are, be looking at some icons but if you want to know which current directory you are on the command line, you need to ask by using the &lt;strong&gt;pwd&lt;/strong&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you would see something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; Savvies-MBP:desktop sammiesavvie&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;projects
&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; Savvies-MBP:projects sammiesavvie&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;
/Users/sammiesavvie/desktop/projects
&lt;span class="o"&gt;(&lt;/span&gt;base&lt;span class="o"&gt;)&lt;/span&gt; Savvies-MBP:projects sammiesavvie&lt;span class="nv"&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;/Users/sammiesavvie/desktop/projects&lt;/strong&gt; is the path to the current directory I am working on and it also means that I am in the "projects" directory.&lt;br&gt;
often times when your see paths like /sammiesavvie/desktop/projects, it means the destination is "projects" but "projects" folder is inside desktop directory while "desktop" is also inside "sammiesavvie" directory.&lt;/p&gt;

&lt;p&gt;Now that I am in the "projects" directory, Let's imagine I want to &lt;em&gt;go back&lt;/em&gt; to the desktop, desktop  ← projects. In GUI, you would usually see a &lt;em&gt;go back&lt;/em&gt; icon but on the command line you need to type this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ..
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I have navigated back to my desktop directory&lt;/p&gt;

&lt;p&gt;List all files in a directory:&lt;/p&gt;

&lt;p&gt;To see all the files in a particular directory, make sure you have navigated into the directory and then type this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1dxk7ml4lc6tfay7d9u4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1dxk7ml4lc6tfay7d9u4.png" alt="list files"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see the files I have in my project folder is listed, there are some hidden files that is excluded tho. to include the hidden files use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rename and Delete files:&lt;br&gt;
If a file named homepage.html is inside my projects folder and the projects folder is inside the desktop directory, the path to the file will look like this ~/desktop/projects/homepage.html. To rename a file use &lt;strong&gt;mv&lt;/strong&gt; . for example to rename homepage.html to about.html&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~/desktop/projects/homepage.html ~/desktop/projects/about.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will rename the file. while this method works, it can also be tricky in that you need to be able to provide the correct path and the file name. usually I will just nagivate my way to the file from desktop → projects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/desktop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;note that you do not need this command if you are already on your desktop&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;projects
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now to rename the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mv &lt;/span&gt;homepage.html about.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fymi3orc19hshb4mevzyt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fymi3orc19hshb4mevzyt.png" alt="mv file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, I do not see any prompt that the file has been renamed but if I look at the "projects" folder, I will see that the file has been renamed, I can also do see this by using the &lt;strong&gt;ls&lt;/strong&gt; command:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7uulp37toc7qlepftdu3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7uulp37toc7qlepftdu3.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I now see the file renamed as "about.html"&lt;/p&gt;

&lt;p&gt;Delete a file:&lt;br&gt;
To delete a file i will use the &lt;strong&gt;rm&lt;/strong&gt; command but be sure that you are in the right directory when the file is located:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm &lt;/span&gt;about.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;so far, I have talked about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[x] cd -to change directory&lt;/li&gt;
&lt;li&gt;[X] mkdir -make directory&lt;/li&gt;
&lt;li&gt;[X] ls -list files&lt;/li&gt;
&lt;li&gt;[X] pwd -print working directory&lt;/li&gt;
&lt;li&gt;[X] touch -to create a new file&lt;/li&gt;
&lt;li&gt;[X] cd .. -change up directory&lt;/li&gt;
&lt;li&gt;[X] mv -to rename a file&lt;/li&gt;
&lt;li&gt;[X] rm -delete a file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This are most of the Linux commands for working with files.&lt;/p&gt;

&lt;p&gt;In this article, You have learnt the two ways we interact with the computer and how you can use Linux commands to work with files using CLI. Although, Command Line interface may seems difficult and stressing but understanding it is important as it is very powerful and fast.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to create a stores Rest API using Flask</title>
      <dc:creator>Aderibigbe Samuel</dc:creator>
      <pubDate>Wed, 29 Mar 2023 07:42:06 +0000</pubDate>
      <link>https://dev.to/savviesammie/how-to-create-a-stores-rest-api-using-flask-3l02</link>
      <guid>https://dev.to/savviesammie/how-to-create-a-stores-rest-api-using-flask-3l02</guid>
      <description>&lt;p&gt;In this tutorial, I'll show you how to build an API using the RESTful architecture and here's what the API will be able to do; receive requests from a client(such as a web application) and respond with some data. Using the API, clients will be able to create store and create items within a store. One of the main benefits of REST APIs is that they rely on the HTTP standard, which means you can use XML, JSON, HTML, etc for processing data. This makes REST APIs fast, and lightweight-which is necessary for web apps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Article Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What is an API?&lt;/li&gt;
&lt;li&gt;
What makes an API Restful? &lt;/li&gt;
&lt;li&gt;Creating a store Restful API&lt;/li&gt;
&lt;li&gt;Initial set up for Flask App&lt;/li&gt;
&lt;li&gt;Defining the API endpoint&lt;/li&gt;
&lt;li&gt;Testing the API&lt;/li&gt;
&lt;li&gt;
Create New Stores &lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is an API?
&lt;/h2&gt;

&lt;p&gt;API stands for Application Programming Interface, which is a way for two or more computer programs to communicate with each other. APIs are more like a contract, they tells us how to use them and what sort of data we should expect to receive, they are meant to make your work as a developer easier by providing abstraction from what happens underneath. Think of a simple website, it has HTML, CSS, and Javascript, all working together to give you a web page. An API is just the data, and you often need to combine data with HTML, CSS, and Javascript. In its basic form, an API is a data-only communication between the server and the client.&lt;/p&gt;

&lt;h2&gt;
  
  
  What makes an API Restful?
&lt;/h2&gt;

&lt;p&gt;The term REST is an acronym for Representational State Transfer and it is an architectural style that describes the architecture of the web. It is a set of rules or conventions on how to structure an API. When you follow this set of rules to create an API, it gives your API some properties which then make the API restful. The REST architectural style defines six guiding constraints which are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;client-server communication&lt;/li&gt;
&lt;li&gt;stateless communication&lt;/li&gt;
&lt;li&gt;caching&lt;/li&gt;
&lt;li&gt;uniform interface&lt;/li&gt;
&lt;li&gt;layered system&lt;/li&gt;
&lt;li&gt;code on demand&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Creating a store Restful API
&lt;/h2&gt;

&lt;p&gt;Let's build a store API&lt;/p&gt;

&lt;h3&gt;
  
  
  Prequisites:
&lt;/h3&gt;

&lt;p&gt;You'll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pip installed on your pc&lt;/li&gt;
&lt;li&gt;Python 3.10 on your Windows or Mac&lt;/li&gt;
&lt;li&gt;A Text Editor &lt;/li&gt;
&lt;li&gt;Insomnia(an API testing tool)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Installing Python 3.10 on Windows OS:
&lt;/h3&gt;

&lt;p&gt;Before you can start this tutorial, you need python 3.10 or a later version installed on your pc. There are different ways to get python installed on your pc but I will be explaining the easiest way. You can download and install the Python 3.10 installer from the Python download page &lt;a href="https://www.python.org/downloads/release/python-3100/"&gt;here&lt;/a&gt;, choose either the 32-bit or 64-bit version depending on your PC (check your PC's information) and make sure to add python 3.10 to path.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--K5tSsLFy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i4wttkmhk7a7nxtg25wi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K5tSsLFy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i4wttkmhk7a7nxtg25wi.png" alt="python3.10 installed for windows" width="800" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To check if the installation was successful, You can go into your command prompt and type the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it should output the version of python installed on your pc.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Python 3.10 on Mac OS:
&lt;/h3&gt;

&lt;p&gt;For mac users, the easiest way is probably using a  macOS 64-bit universal2 installer. Just go to &lt;a href="https://www.python.org/downloads/release/python-3100/"&gt;https://www.python.org/downloads/release/python-3100/&lt;/a&gt; and choose the macOS 64-bit universal2 installer, download the installer, and run it on your mac. You can just click this &lt;a href="https://www.python.org/ftp/python/3.10.0/python-3.10.0-macos11.pkg"&gt;link&lt;/a&gt; to start the download right away.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wrwon7ip--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2wrzs17r1dy7uk0dl4v.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wrwon7ip--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2wrzs17r1dy7uk0dl4v.jpg" alt="python3.10 installed for mac" width="620" height="434"&gt;&lt;/a&gt;&lt;br&gt;
To check which python version you have, type the following on your command prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python3 --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Initial set up for Flask App
&lt;/h3&gt;

&lt;p&gt;First, you need to create a virtual environment and install the dependencies. Before we proceed, you should have created a project folder and navigated to that folder on your terminal or powershell.&lt;br&gt;
To create the virtual environment type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3.10 -m venv .venv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Depending on the text editor you are using, you need to select which interpreter to use and it should be the one that has the path to your virtual environment. Do not know how to do this? A quick google search will help you. for Visual studio code( a popular text editor) the shortcut is command+shift+P.&lt;/p&gt;

&lt;p&gt;let step is to install flask:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install flask
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that You have flask installed, let's create a boiler plate. Go into your text editor and create a file, let's call it app.py and the follow lines of code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt; 

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;#this creates a flask app
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;make sure that your file name(app.py) is consistent with the name of your variable 'app' (remember python is case-sensitive).&lt;br&gt;
The next step is to run the flask app, you can do these from your terminal or powershell. Make sure you are in the app.py directory and your virtual environment is activated. To run the flask app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flask run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you should see something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9fDw-tf4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ea68bm9gp6trm68pc6u0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9fDw-tf4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ea68bm9gp6trm68pc6u0.png" alt="flask running message" width="800" height="81"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;you get the information of where your app is running in our example, it is running on &lt;a href="http://127.0.0.1:5000"&gt;http://127.0.0.1:5000&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Defining the API endpoint
&lt;/h2&gt;

&lt;p&gt;When an API interacts with another system, the touchpoints of this communication are considered endpoints. The place that APIs send requests and where the resources are stored is called an endpoint. simply put, An endpoint is one end of a communication channel.&lt;br&gt;
We need to define where we will store our data. Usually, you will make use of databases but for this tutorial we will store our data in a python list. So, you will create a list of stores that consists of one dictionary per store.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;stores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"Ekaabo Cosmetics"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"items"&lt;/span&gt;&lt;span class="p"&gt;:[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"lip gel"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="s"&gt;"price"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;20.36&lt;/span&gt;
     &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"moisturizer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="s"&gt;"price"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;38.90&lt;/span&gt;
     &lt;span class="p"&gt;},&lt;/span&gt; 
     &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"hair wigs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s"&gt;"price"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;50.89&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"Body Cream"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="s"&gt;"price"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;12.46&lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;what we've done is simple, dictionaries consist of key-value pair. For the example above, there's a name key and the value is the actual name of the store. The confusing part would be the items, the key is "items", the value consists of a list which in turn consist of dictionaries of name and price pair, hope it sinks. &lt;/p&gt;

&lt;p&gt;Now let's create an endpoint that will return data when a client requests for it. Add the following lines to your code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/store"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_stores&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"stores"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;stores&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;The endpoint is the "/store" while the function associated with it is the get_stores().&lt;br&gt;
Since our app is running on &lt;a href="http://127.0.0.1:5000"&gt;http://127.0.0.1:5000&lt;/a&gt;, go to your browser and enter &lt;a href="http://127.0.0.1:5000/store"&gt;http://127.0.0.1:5000/store&lt;/a&gt; to access the page, but before that run the flask application again in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flask run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can open the link on your browser:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XrTo5w9d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ijz4k8oxua8k84z4hx8s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XrTo5w9d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ijz4k8oxua8k84z4hx8s.png" alt="api rendered on the web" width="800" height="126"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note that the data displayed is in JSON format and ordering does not matter as seen above that the order does not follow how we wrote the data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing the API
&lt;/h3&gt;

&lt;p&gt;To verify that the API works, you need to test it, by making requests and check that the responses match what we expect. There are tools you can use to test your API e.g Postman, Locust, Insomnia,etc. For the purpose of this tutorial, We'll use Insomnia, it has a free trial and ids easy to use. You can can download it by clicking &lt;a href="https://insomnia.rest/download"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1rP7LEHy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b6az6qnsiyhk0qolfw6z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1rP7LEHy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b6az6qnsiyhk0qolfw6z.png" alt="Insomnia download" width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that the app is runnning on your pc, let's test our API, click on the + icon to select "HTTP Request", then enter the url &lt;a href="http://127.0.0.1:5000/store"&gt;http://127.0.0.1:5000/store&lt;/a&gt; in the GET search bar. You must ensure your flask app is running before you enter the URL and click send&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XHTSvFDS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rav7ae5zdjrtcs4jnzur.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XHTSvFDS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rav7ae5zdjrtcs4jnzur.png" alt="how to get request" width="800" height="500"&gt;&lt;/a&gt;&lt;br&gt;
After entering the URL in the GET search bar, you can output like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v_3qftMg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ngw48ybhewuyho88g6m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v_3qftMg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ngw48ybhewuyho88g6m.png" alt="get request search bar" width="800" height="374"&gt;&lt;/a&gt;&lt;br&gt;
You should see the data that your API returns. It means the API's GET request is working fine.&lt;/p&gt;
&lt;h3&gt;
  
  
  Create New Stores
&lt;/h3&gt;

&lt;p&gt;To create new store in our API,we will be receiving JSON from our client(Insomnia App), We'll receive the stored data and add it to our stores list, so that it then stays and the client can make requests to retrieve them. Instead of using a GET request, You will use a POST request and you need to include some JSON data&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--By9GEhIW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5mzms7y9ittjwtbs48n2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--By9GEhIW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5mzms7y9ittjwtbs48n2.png" alt="post request" width="800" height="500"&gt;&lt;/a&gt; &lt;br&gt;
Now go into your text editor and add the following lines of code in the 'app.py' file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="c1"&gt;#I modified this line
&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;stores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"Ekaabo Cosmetics"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"items"&lt;/span&gt;&lt;span class="p"&gt;:[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"lip gel"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="s"&gt;"price"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;20.36&lt;/span&gt;
     &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"moisturizer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="s"&gt;"price"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;38.90&lt;/span&gt;
     &lt;span class="p"&gt;},&lt;/span&gt; 
     &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"hair wigs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s"&gt;"price"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;50.89&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"Body Cream"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="s"&gt;"price"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;12.46&lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;


&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/store"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_stores&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"stores"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;stores&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/store"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;post_store&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;request_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;# you need to import json
&lt;/span&gt;    &lt;span class="n"&gt;new_store&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;request_data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="s"&gt;"items"&lt;/span&gt;&lt;span class="p"&gt;:[]}&lt;/span&gt;
    &lt;span class="n"&gt;stores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;new_store&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;#append new store to the list
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;new_store&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;201&lt;/span&gt; &lt;span class="c1"&gt;#return the store and status code
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now run the flask application in the terminal or powershell and then go to the Insomnia app and make a POST request.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u-l4f1i7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6cflagvs8whf2xpkbjsa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u-l4f1i7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6cflagvs8whf2xpkbjsa.png" alt="post and include Json" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's include some JSON data:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--usAkdn-w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8p8qq0w52pfrifqrpq6n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--usAkdn-w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8p8qq0w52pfrifqrpq6n.png" alt="Include JSON" width="800" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, hit the send button and you will the output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NTRYXkFj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y1jtapaq2xxx3pmt6j3p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NTRYXkFj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y1jtapaq2xxx3pmt6j3p.png" alt="post created" width="434" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You get a status message "successfully created". &lt;/p&gt;

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

&lt;p&gt;In this article, we covered what APIs are and what makes an API Restful. You now understand how APIs helps with interaction between the client and the server. You built a simple stores API and tested it using Insomnia.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Two Sum - LeetCode problem 1 solution in python</title>
      <dc:creator>Aderibigbe Samuel</dc:creator>
      <pubDate>Wed, 15 Mar 2023 18:15:12 +0000</pubDate>
      <link>https://dev.to/savviesammie/two-sum-leetcode-problem-1-solution-in-python-4al9</link>
      <guid>https://dev.to/savviesammie/two-sum-leetcode-problem-1-solution-in-python-4al9</guid>
      <description>&lt;p&gt;In this article, I will be sharing my approach to solving the Two sum problem on LeetCode. Like every other problem, the important thing is how you approach the problem or what we call an algorithm in programming, it does not really matter the language used. The approach in this tutorial can be used in any programming, not just python alone.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Motivation:&lt;/strong&gt; I spend most of my free time on &lt;a href="https://www.hackerrank.com/access-account/" rel="noopener noreferrer"&gt;hackerRank&lt;/a&gt; and &lt;a href="https://leetcode.com/" rel="noopener noreferrer"&gt;leetCode&lt;/a&gt; trying out different problems. This will help improve your problem-solving skills.&lt;/p&gt;

&lt;p&gt;Two sum problems: &lt;a href="https://leetcode.com/problems/two-sum/" rel="noopener noreferrer"&gt;Link&lt;/a&gt; to problem on leetCode&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe33lsgd65xguet1a2e3v.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe33lsgd65xguet1a2e3v.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;My First Approach&lt;/strong&gt; The simple approach is to use two nested loops. when we have two nested loops, one is the outer loop while the other is the inner loop. Since the first input is a list, the outer loop iterates over all the elements of the list, and the inner loop iterates from the current index of the outer loop up to the end of the list. here's the part where you want to grab a pen and paper and write a simple algorithm&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8i0fq2b3ydvc3ty15cmz.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8i0fq2b3ydvc3ty15cmz.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⏩ &lt;strong&gt;Writing the Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2y8la30hg3qkbkdhg1r.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2y8la30hg3qkbkdhg1r.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ ✅ ✅ The code works&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0gzgnnwh45zf2qfdn725.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0gzgnnwh45zf2qfdn725.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;while the solution passed all the cases, You can see that the time complexity is not good enough and the code can be improved to execute faster. here the complexity is quadratic O(N²) which means the performance is proportional to the square of the size of the input elements. The code can be written efficiently if we make use of a dictionary and iterate over the list just once&lt;/p&gt;

&lt;p&gt;✏️✏️ &lt;strong&gt;The Algorithmn&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh1br2l86pnypmnolbuyr.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh1br2l86pnypmnolbuyr.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
⏩ &lt;strong&gt;The code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F72capny6k3n88eaw9l76.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F72capny6k3n88eaw9l76.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
✅ ✅ ✅ The code works: this time the code didn't just work but it was more faster&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8qzaatrws0yi53lub2g8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8qzaatrws0yi53lub2g8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The complexity of this algorithm is O(n) which is faster than the one we implemented previously&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt; In this short guide, I showed you two approaches I used to solve the Two sum problem on leetCode. The first solution was good but not efficient while the second solution was more efficient. I hope I was able to make you see the importance of writing out your algorithm first before solving the problem and finally this approach can be used in other languages too.&lt;/p&gt;

&lt;p&gt;say hi to me on Twitter &lt;a href="https://twitter.com/Sammie_savvie" rel="noopener noreferrer"&gt;@Sammie_savvie&lt;/a&gt;&lt;/p&gt;

</description>
      <category>leetcode</category>
      <category>algorithms</category>
      <category>python</category>
      <category>problemsolving</category>
    </item>
    <item>
      <title>Upload files to Github - a comprehensive guide</title>
      <dc:creator>Aderibigbe Samuel</dc:creator>
      <pubDate>Thu, 16 Feb 2023 17:08:23 +0000</pubDate>
      <link>https://dev.to/savviesammie/upload-files-to-github-a-comprehensive-guide-3d3e</link>
      <guid>https://dev.to/savviesammie/upload-files-to-github-a-comprehensive-guide-3d3e</guid>
      <description>&lt;p&gt;You just finished a project on your local PC. You are looking for a place to keep it so that you can access it anywhere and anytime or you just started a new project and you will be developing over a long time with some of your friends but you need to make it accessible to them, Hold on this article is for you.&lt;/p&gt;

&lt;p&gt;Over the years, GitHub has been the most popular internet hosting service for version control using Git. GitHub makes it easy for you to store your files, track changes made to your files and collaborate on software projects. Github also serves as a portfolio site where developers can showcase their work, ask others to review it and work on open-source projects. So I'm sure You would have known by now that using GitHub is a good idea for you.&lt;/p&gt;

&lt;p&gt;In this article, I will be guiding you on how you can setup Git on your PC and start loading files to your GitHub account from your local computer. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Article Summary:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create a GitHub account&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Download and Setup Git&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Upload files on Github&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Other Git commands you'll need&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Create a Github account&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before you can start using Git and GitHub, the first thing is to download a GitHub account. Go to your browser and search GitHub or click this link &lt;a href="https://github.com" rel="noopener noreferrer"&gt;github.com&lt;br&gt;
&lt;/a&gt; &lt;br&gt;
Click on the signup button and follow the steps to finish setting up your account. Now that you have an account, You need to create a new repository. A Git repository helps to save and track all the changes made to your files. &lt;br&gt;
To create a new repository, click on repositories and click on new. You can decide to make the repository private or public. Public, if you want others to have access to it and private, if you want to keep the files to yourself. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb6r42ebq3tcty7nxd91l.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb6r42ebq3tcty7nxd91l.jpg" alt=" " width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extra tips:&lt;/strong&gt; Choose a file name that gives an intuition about what your project is about e.g myPortfolioWebsite, LearningApp, Hotel_landing_page, etc also include a readme file where you write a good description of your project.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Download and Install Git&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before you can start using Git, you need it installed on your pc. There are different ways to get git installed on your pc but I will be explaining some of the easiest ways.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Window Users&lt;/strong&gt;&lt;br&gt;
Download the &lt;a href="https://git-scm.com/downloads" rel="noopener noreferrer"&gt;latest version&lt;/a&gt; of Git and choose either the 32-bit or 64-bit version depending on your PC (check your PC's information). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8e9mujx8bg6knfre4kn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8e9mujx8bg6knfre4kn.jpg" alt=" " width="800" height="445"&gt;&lt;/a&gt;&lt;br&gt;
Install the downloaded file. Once installed, launch the Git bash and finish the setup.&lt;br&gt;
You can read more on installing Git on windows &lt;a href="https://phoenixnap.com/kb/how-to-install-git-windows" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mac Users&lt;/strong&gt;&lt;br&gt;
For mac users, the easiest way is probably using a binary installer. Just go to &lt;a href="https://git-scm.com/download/mac" rel="noopener noreferrer"&gt;https://git-scm.com/download/mac&lt;/a&gt; and choose the binary installer option, download the installer, and run it on your mac&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffj248s5tc2eltluxghg8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffj248s5tc2eltluxghg8.jpg" alt=" " width="730" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Linux Users&lt;/strong&gt;&lt;br&gt;
Linux distribution comes with a package management tool that makes it simple to install git&lt;br&gt;
From your shell, install Git using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt install git-all 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify the installation was successful by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git --version 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Configure Git&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Now that you have successfully installed Git on your system, You need to do some setup to customize your experience using Git.&lt;br&gt;
Git Email and username: replace 'savviesammie' with your GitHub username&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git config --global user.name "savviesammie"
&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;$ git config --global user.email "savviesammie@gmail.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Upload Files on GitHub&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Remember the repository You created at the beginning of the tutorial? You will be cloning it on your pc and interacting with Git from your terminal. So go to your terminal and follow the tutorial.&lt;br&gt;
cloning a repository means you are copying the repository from GitHub to your local computer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Clone the repository&lt;br&gt;
Go to the repository you created on GitHub, click the green "code" button, and copy the link to your repository from the drop-down.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd1ika1rri9hvxq8q00na.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd1ika1rri9hvxq8q00na.jpg" alt=" " width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Go to your terminal and type&lt;br&gt;
git clone &lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git clone https://github.com/savvieSammie/password_manager.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace the "repository url" with the link you copied.&lt;br&gt;
make sure you have a good internet connection on your pc as you will be downloading the directory. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Put your files in the cloned repository:&lt;br&gt;
Open the empty directory and add the files that you want to upload. Say for example, you have written some codes using a text editor and you have the file saved on your pc, transfer the file to the directory you cloned from GitHub and make sure to Confirm the list of files present &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Git add&lt;br&gt;
Add the files to Git's staging area by typing&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git add .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; Commit the files to Git by using the git commit command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git commit -m "some message"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;replacing "some message" with a short description of the changes you made to the first. In your case, since it's the first time, you can just write "first commit"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6:&lt;/strong&gt; Set your remote repository&lt;br&gt;
Earlier in step 1, you copied the url to your remote repository. You need it here to setup your remote repository, use the command &lt;br&gt;
$ git remote add origin &lt;/p&gt;

&lt;p&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; git remote add origin https://github.com/savvieSammie/password_manager.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 7:&lt;/strong&gt; Git to push&lt;br&gt;
push those files to your GitHub by using the command&lt;br&gt;
$ git push  &lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git push -u origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The origin is your default remote repository name and the '-u' flag is upstream.&lt;br&gt;
You will be prompted to fill in your GitHub username and password.&lt;/p&gt;

&lt;p&gt;Now you can go to GitHub on your web browser, you will see the changes reflected.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Other Git Commands you need&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;git init&lt;/strong&gt; - Initialize local a new repository&lt;br&gt;
&lt;strong&gt;git status&lt;/strong&gt; -shows what you have in your staging area&lt;br&gt;
&lt;strong&gt;git add &lt;/strong&gt; - adds files and folders to the staging area&lt;br&gt;
&lt;strong&gt;git diff&lt;/strong&gt; - compare and understand changes made to your files&lt;br&gt;
&lt;strong&gt;git log&lt;/strong&gt; -  is used to view the log of the project's history.&lt;br&gt;
&lt;strong&gt;git push&lt;/strong&gt; - Takes a local repository and pushes to a remote repository (Github).&lt;br&gt;
&lt;strong&gt;git show&lt;/strong&gt; - to show the details of a specific commit&lt;br&gt;
&lt;strong&gt;git pull&lt;/strong&gt; - Pull latest changes from remote repository&lt;br&gt;
*&lt;em&gt;git clone *&lt;/em&gt;- Clone repo from GitHub&lt;/p&gt;

&lt;p&gt;To view the official Git cheatsheet from Github, click &lt;a href="https://education.github.com/git-cheat-sheet-education.pdf" rel="noopener noreferrer"&gt;Git cheat sheet&lt;/a&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this article, I have shown you how to create a GitHub account, setup Git on your PC and how to upload files from your local computer to GitHub. I also included some Git commands that you'll need. &lt;br&gt;
By now, you should have Git running on your pc and also you have gained basic working knowledge of Git and Github.&lt;/p&gt;

&lt;p&gt;Say hi to me on Twitter &lt;a href="https://twitter.com/Sammie_savvie?t=SB6V1YTT6uwn1CwrvFoFaw&amp;amp;s=09" rel="noopener noreferrer"&gt;@Sammie_savvie&lt;/a&gt;&lt;/p&gt;

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