<?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: RaShunda Lanier</title>
    <description>The latest articles on DEV Community by RaShunda Lanier (@thrtn85dev).</description>
    <link>https://dev.to/thrtn85dev</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%2F377613%2Fa2a3af0c-3bb2-4ede-a05c-f6036648c271.png</url>
      <title>DEV Community: RaShunda Lanier</title>
      <link>https://dev.to/thrtn85dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thrtn85dev"/>
    <language>en</language>
    <item>
      <title>GIT Cheatsheet</title>
      <dc:creator>RaShunda Lanier</dc:creator>
      <pubDate>Thu, 11 Jul 2024 04:30:25 +0000</pubDate>
      <link>https://dev.to/thrtn85dev/git-cheatsheet-429o</link>
      <guid>https://dev.to/thrtn85dev/git-cheatsheet-429o</guid>
      <description>&lt;p&gt;Here's a git cheat-sheet that covers some of the most commonly used git commands:&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuration
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global user.name "Your Name"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Sets your name for all git repositories on your computer
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global user.email "youremail@example.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Sets your email address for all git repositories on your computer
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global color.ui auto
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enables colored output in the terminal&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a repository
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;: Initializes a new git repository in the current directory&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 &amp;lt;repository_url&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;: Clones an existing repository from a remote server to your local machine&lt;/p&gt;

&lt;h2&gt;
  
  
  Staging changes
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;: Adds a file to the staging area&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;: Adds all changed files in the current directory to the staging area&lt;/p&gt;

&lt;h2&gt;
  
  
  Committing changes
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;: Commits the staged changes with a message describing the changes made&lt;/p&gt;

&lt;h2&gt;
  
  
  Branching
&lt;/h2&gt;

&lt;p&gt;git branch: Lists all local branches&lt;br&gt;
git branch : Creates a new branch&lt;br&gt;
git checkout : Switches to a different branch&lt;br&gt;
git merge : Merges changes from the specified branch into the current branch&lt;/p&gt;

&lt;h2&gt;
  
  
  Remote repositories
&lt;/h2&gt;

&lt;p&gt;git remote add  : Adds a new remote repository&lt;br&gt;
git push  : Pushes changes to the specified branch in the remote repository&lt;br&gt;
git pull  : Pulls changes from the specified branch in the remote repository&lt;/p&gt;

&lt;h2&gt;
  
  
  Viewing information
&lt;/h2&gt;

&lt;p&gt;git status: Shows the status of the current branch and any changed files&lt;br&gt;
git log: Displays a log of all commits on the current branch&lt;br&gt;
git diff: Shows the differences between the working directory and the staging area&lt;br&gt;
git diff --staged: Shows the differences between the staging area and the last commit&lt;/p&gt;

</description>
      <category>git</category>
      <category>beginners</category>
      <category>cheatsheet</category>
      <category>learning</category>
    </item>
    <item>
      <title>Exploring Linux Basics: Notes from an Aspiring Cloud Engineer</title>
      <dc:creator>RaShunda Lanier</dc:creator>
      <pubDate>Thu, 11 Jul 2024 04:07:31 +0000</pubDate>
      <link>https://dev.to/thrtn85dev/exploring-linux-basics-notes-from-an-aspiring-cloud-engineer-532o</link>
      <guid>https://dev.to/thrtn85dev/exploring-linux-basics-notes-from-an-aspiring-cloud-engineer-532o</guid>
      <description>&lt;p&gt;Welcome to my blog series on Linux Basics for Hackers! &lt;/p&gt;

&lt;p&gt;As an aspiring cloud engineer, I recognize the importance of mastering Linux. In this series, I'll share my journey chapter by chapter, reviewing my notes and breaking down key concepts. This approach will help both myself and fellow newcomers understand and master the fundamentals of Linux, an essential skill set for any cloud engineer. &lt;/p&gt;

&lt;p&gt;Join me as I explore each chapter, demystify complex topics, and build a solid foundation in Linux. Let's learn together!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>cloudcomputing</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>Ternary Operators &amp; Codewars</title>
      <dc:creator>RaShunda Lanier</dc:creator>
      <pubDate>Fri, 11 Aug 2023 01:28:42 +0000</pubDate>
      <link>https://dev.to/thrtn85dev/ternary-operators-codewars-1a60</link>
      <guid>https://dev.to/thrtn85dev/ternary-operators-codewars-1a60</guid>
      <description>&lt;h2&gt;
  
  
  Ternary Operators
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;ray: I'm learning about ternary operators in python. I want to return a value based on a condition. How do you use 'return' in this case?&lt;/p&gt;

&lt;p&gt;meg: Hey Ray! Ternary operators in Python are a concise way to write conditional expressions. They allow you to return a value based on a condition without using a full if-else statement. The basic syntax of a ternary operator is:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;value_if_true&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;condition&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;value_if_false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;You can use the &lt;code&gt;return&lt;/code&gt; keyword in combination with a ternary operator to directly return a value based on a condition.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Codewars
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Kata
&lt;/h3&gt;

&lt;p&gt;Create a function that takes an integer as an argument and returns "Even" for even numbers or "Odd" for odd numbers.&lt;/p&gt;

&lt;h4&gt;
  
  
  My approach
&lt;/h4&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;even_or_odd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Even&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Odd&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;even_or_odd&lt;/code&gt; function uses a ternary operator to determine whether the input &lt;code&gt;number&lt;/code&gt; is even or odd, and then immediately returns the corresponding string.&lt;/p&gt;

&lt;h4&gt;
  
  
  Interesting Variation
&lt;/h4&gt;

&lt;p&gt;I thought this approach was pretty cool. I didn't understand what was happening at first.&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;even_or_odd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;number&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Even&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;Odd&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;ray: Explain this approach...&lt;/p&gt;

&lt;p&gt;meg: Certainly, Ray! The approach you provided is a compact way to achieve the same result as using a ternary operator. This method relies on the fact that Python allows indexing of a list using boolean values (where &lt;code&gt;False&lt;/code&gt; is equivalent to &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;True&lt;/code&gt; is equivalent to &lt;code&gt;1&lt;/code&gt;). &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's break down the code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The function &lt;code&gt;even_or_odd&lt;/code&gt; takes a single argument, &lt;code&gt;number&lt;/code&gt;, which is the number you want to check.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;number % 2&lt;/code&gt; calculates the remainder when &lt;code&gt;number&lt;/code&gt; is divided by &lt;code&gt;2&lt;/code&gt;. If the remainder is &lt;code&gt;0&lt;/code&gt;, it means the number is even. If the remainder is &lt;code&gt;1&lt;/code&gt;, it means the number is odd.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;["Even", "Odd"]&lt;/code&gt; creates a list containing two elements: &lt;code&gt;"Even"&lt;/code&gt; at index &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;"Odd"&lt;/code&gt; at index &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The expression &lt;code&gt;[number % 2]&lt;/code&gt; is used as an index to this list. If &lt;code&gt;number % 2&lt;/code&gt; is &lt;code&gt;0&lt;/code&gt;, it will access the element at index &lt;code&gt;0&lt;/code&gt; (&lt;code&gt;"Even"&lt;/code&gt;), and if &lt;code&gt;number % 2&lt;/code&gt; is &lt;code&gt;1&lt;/code&gt;, it will access the element at index &lt;code&gt;1&lt;/code&gt; (&lt;code&gt;"Odd"&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The value retrieved from the list (either &lt;code&gt;"Even"&lt;/code&gt; or &lt;code&gt;"Odd"&lt;/code&gt;) is then immediately returned by the &lt;code&gt;return&lt;/code&gt; statement.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, in essence, this approach uses the remainder of the division to index the list of strings, directly returning the appropriate string based on whether the number is even or odd. It's a creative way to achieve the same result as a ternary operator, but it might be less intuitive for readers who are not familiar with this technique.&lt;/p&gt;

&lt;h4&gt;
  
  
  Rank Up Challenge
&lt;/h4&gt;

&lt;p&gt;If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.&lt;/p&gt;

&lt;p&gt;Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in. Additionally, if the number is negative, return 0 (for languages that do have them).&lt;/p&gt;

&lt;p&gt;Note: If the number is a multiple of both 3 and 5, only count it once.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Courtesy of projecteuler.net (Problem 1)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I've completed this before so I decided to try another approach.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Original Approach
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;multiplesOf3and5&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
     &lt;span class="n"&gt;multiples&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="c1"&gt;# initialize array
&lt;/span&gt;
     &lt;span class="c1"&gt;# loop through numbers and append to array if multiples of 3 or 5
&lt;/span&gt;     &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;number&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;x&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
               &lt;span class="n"&gt;multiples&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

     &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;multiples&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="nf"&gt;multiplesOf3and5&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# New Approach
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;solution&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
   &lt;span class="c1"&gt;# loop through numbers and append to array if multiples of 3 or 5
&lt;/span&gt;    &lt;span class="n"&gt;multiples&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;number&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;x&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;multiples&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way uses a list comprehension to iterate through numbers from 1 to number - 1, appending those that are multiples of 3 or 5 to the multiples list. This approach directly constructs the desired list without the need for separate appending operations.&lt;/p&gt;




&lt;h2&gt;
  
  
  Take Aways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ternary operators are best suited for simple conditional expressions. If your condition involves complex logic, it might be clearer to use a traditional if-else statement.&lt;/li&gt;
&lt;li&gt;List comprehension offers a shorter syntax when you want to create a new list based on the values of an existing list.&lt;/li&gt;
&lt;/ul&gt;

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