<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by thequeenbeebs on Medium]]></title>
        <description><![CDATA[Stories by thequeenbeebs on Medium]]></description>
        <link>https://medium.com/@thequeenbeebs?source=rss-a4ebb4e6b0c7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6HoXp5UBkFiOl_KGwhLvNw.jpeg</url>
            <title>Stories by thequeenbeebs on Medium</title>
            <link>https://medium.com/@thequeenbeebs?source=rss-a4ebb4e6b0c7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 10 May 2026 23:54:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thequeenbeebs/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[I Like Turtles.]]></title>
            <link>https://thequeenbeebs.medium.com/i-like-turtles-9d7bf84593a6?source=rss-a4ebb4e6b0c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d7bf84593a6</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[turtle-graphics]]></category>
            <dc:creator><![CDATA[thequeenbeebs]]></dc:creator>
            <pubDate>Thu, 23 Sep 2021 22:27:55 GMT</pubDate>
            <atom:updated>2021-09-23T22:27:55.565Z</atom:updated>
            <content:encoded><![CDATA[<h4>Having fun with the Python Turtle module.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r4nC5Uk3-QvAk4Tp" /><figcaption>Photo by <a href="https://unsplash.com/@francesco_ungaro?utm_source=medium&amp;utm_medium=referral">Francesco Ungaro</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As my loyal blog readers have now learned, I am slowly becoming Python’s number one fan. But, did you know that Python is also friends with another reptile? Introducing: Turtle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*pxyf9BDFKbCJK3tBBbwSTg.gif" /></figure><p>The Turtle module is a Graphical User Interface (or GUI) that you can import and use in your Python projects. The <a href="https://docs.python.org/3/library/turtle.html">documentation</a> calls it “a popular way for introducing programming to kids” but I would say adults like fun things too and this is a great resource for visual learners and people getting started with the concepts of Object-Oriented Programming in Python.</p><h3>Turtle Basics</h3><p>The great thing about Turtle is, unlike some other Python packages, it’s already on your machine! No need hunting it down and making sure it’s downloaded; if you have Python downloaded on your computer it is included and you are good to go.</p><h4>Step 1: Import Turtle</h4><p>The module may be downloaded, but you still need to import it into your file. Do it at the top of your file like so:</p><pre>from turtle import Turtle, Screen</pre><p>Turtle and Screen are the two Classes we will be using today, so that’s all we need to import for now.</p><h4>Step 2: Make a Turtle</h4><p>The first thing we need to do is to make our turtle. To do so, we need to call on the Turtle class, followed by two parentheses to signal that we want to build a new instance of the Turtle class.</p><pre>arthur = Turtle()</pre><h4>Step 3: Make a Screen</h4><p>Now that arthur has been brought into existence, we also need to build a screen so we can get a good look at him! This is when we use the Screen class.</p><pre>screen = Screen()</pre><h4>Step 4: Keep Screen Open</h4><p>If you run the code just as is now, you will see a quick flash of the screen and that’s it. What gives? Well, we need to use a special Screen method that will make sure that the screen will only close when we click on the exit, like so:</p><pre>screen.exitonclick()</pre><p>Now, we can get a good look at our turtle:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*OuMkPqPPCmNvuIA2px1JKw.png" /></figure><p>Hmm…Arthur sure isn’t very turtle-y. Let’s get to fixing that!</p><h3>Turtle Methods</h3><p>Arthur the turtle has lots of fun things he can do! Let’s get started with spiffing him up a bit.</p><h4>Shape</h4><p>Like we see above, Arthur is…well, he’s not a turtle. We can change that with the <a href="https://docs.python.org/3/library/turtle.html#turtle.shape">Turtle.shape()</a> method. Check out the documentation to see all of your options, but today I’m going to give Arthur a classic turtle shape, using the string ‘turtle’ as my parameter inside the method.</p><pre>arthur.shape(&#39;turtle&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*R3npGc4fFqsKZC3R6S36cg.png" /></figure><p>Look at that cute guy! Now it’s time to brighten him up a bit.</p><h4>Color</h4><p>Turtle.color() is a method similar to the shape method we discussed above, that takes a string of a color name as its argument and will then change that turtle into said color. I’m gonna go classic and give Arthur a green color:</p><pre>arthur.color(&quot;green&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*GmrmTakNVg9Z9uqxgq-fPQ.png" /></figure><p>Look at that guy! Now he’s all spiffed up and ready for his day.</p><p>These are the basics of the Turtle package, but there is so much you can do with this guy — he can travel all over the screen, he can make art, he can place dots — there are lots of ways to make really cool and creative projects very simply…maybe next time we’ll build a fun project together? For now explore the really helpful <a href="https://docs.python.org/3/library/turtle.html#module-turtle">documentation</a>…happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d7bf84593a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is a Docstring?]]></title>
            <link>https://thequeenbeebs.medium.com/what-is-a-docstring-cc08ec81fcc7?source=rss-a4ebb4e6b0c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc08ec81fcc7</guid>
            <category><![CDATA[docstring]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[thequeenbeebs]]></dc:creator>
            <pubDate>Wed, 15 Sep 2021 02:47:39 GMT</pubDate>
            <atom:updated>2021-09-15T02:47:39.746Z</atom:updated>
            <content:encoded><![CDATA[<h4>And why should I add it to my code?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AG2V_fHs6TJ5ncjv" /><figcaption>Photo by <a href="https://unsplash.com/@taradee?utm_source=medium&amp;utm_medium=referral">Tara Evans</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hello friends! I am in week 3 of my learning journey with Python. I am continuing to love it, and let me just emphasize to any other newbie software engineers that learning your second and third language are <em>significantly </em>easier than learning your first one.</p><p>Something new that I came across this week that I hadn’t yet encountered in Ruby or JavaScript was this little thing called docstrings. Today, I’m going to break down what the hell a docstring is, why you should add them to your code, and how to do just that.</p><h3>What is a Docstring?</h3><p>Docstring is short for <em>documentation string</em>, and it’s exactly what it sounds like! It’s a string literal that is used to help explain a specific line of code. For example, let’s say I’m using the len() function in Python:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*qkIDs8b8uHtNsj9J3c3H5w.png" /></figure><p>Do you see the description above the len() function while I’m typing out the code? That is the docstring found in the actual Python documentation to help explain the len() function if you need a little reminder. But, what’s even cooler is you can create your own docstrings for the functions you build out in your Python projects. Check it out below!</p><h3>Implementing Docstrings into Your Code</h3><p>The symbol for implementing a docstring is quite simple: three sets of quotation marks:</p><pre>&quot;&quot;&quot;Inside these three quotations is my docstring.&quot;&quot;&quot;</pre><p>Pretty easy huh? When you implement it in your code, you want to put it right after you define the function. Let’s say you want to write a function called sum that will add two numbers together. You would add the docstring like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*qpR689wnAT0vTyu1WD9Bag.png" /></figure><p>Now, when I call on the function, here’s what appears:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*HETCNELLPVDXsDQKvJh6YQ.png" /></figure><p>Pretty neat!</p><p>If, for some reason, you want to access that string, it is within the __doc__ object, and you can access it like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*GkPBuXnU7A8hWWrzsDpk1w.png" /></figure><p>***Pro-tip: Make sure you put two underscores on each side of the “doc”…learned that the hard way!</p><h3>Why are docstrings important?</h3><p>Docstrings may seem like a silly and somewhat unnecessary tool for small projects, but once you start building out big applications it can be a really big game changer. If you wrote a function you want to call on that’s 200 lines of code away, rather than scrolling through and trying to find how it works, the docstring will do the work for you and demonstrate not only what the function does, but what parameters to include.</p><p>And that’s it! A simple addition to your Python code that will make your life a lot easier when handling large amounts of code. Check out the official documentation about Python docstrings <a href="https://www.python.org/dev/peps/pep-0257/">here</a>. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc08ec81fcc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cracking the Code Challenge: Run Length Encoding]]></title>
            <link>https://thequeenbeebs.medium.com/cracking-the-code-challenge-run-length-encoding-27cd6c22a40e?source=rss-a4ebb4e6b0c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/27cd6c22a40e</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[encoding]]></category>
            <dc:creator><![CDATA[thequeenbeebs]]></dc:creator>
            <pubDate>Fri, 10 Sep 2021 21:29:57 GMT</pubDate>
            <atom:updated>2021-09-10T21:33:38.250Z</atom:updated>
            <content:encoded><![CDATA[<h4>Another week, another algorithm…</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZiRJ7U0t_NUnDFdX" /><figcaption>Photo by <a href="https://unsplash.com/@joshuaryanphoto?utm_source=medium&amp;utm_medium=referral">Joshua Reddekopp</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi friends! I had a CoderByte assessment for another job application this week that threw me a little bit for a loop: run length encoding. This is a concept I had never heard of so I figured it would be helpful for others to break it down, along with the problem and my solution.</p><p>***Full disclosure and reminder that this is by no means the PERFECT solution to this algorithm and I’m sure there are more “correct” and more efficient answers on the internet; this is just the way I was able to logically solve it in my brain with time constraints!***</p><h3>THE PROBLEM</h3><blockquote>Given an input string, write a function that returns a compressed version of the string using the Run-length encoding algorithm. This algorithm works by taking the occurrence of each repeating character and outputting that number along with a single character of the repeating sequence. For example: “wwwggopp” would return <strong>3w2g1o2p</strong>. The string will not contain any numbers, punctuation, or symbols.</blockquote><h3>BREAKING DOWN RUN-LENGTH ENCODING</h3><p>The first thing I thought when I read this problem was “What the hell is run-length encoding?” I had no flipping clue, and had never heard of this concept in my life. So, what better time then now to learn?</p><p>I like <a href="https://en.wikipedia.org/wiki/Run-length_encoding">Wikipedia’s</a> definition:</p><pre><strong>Run-length encoding</strong> (<strong>RLE</strong>) is a form of <a href="https://en.wikipedia.org/wiki/Lossless_data_compression">lossless data compression</a> in which <em>runs</em> of data (sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the original run.</pre><p>On first glance this seems like a silly and useless concept, but in situations where there are very very large runs of characters, I see where this can make things more efficient.</p><h3>MY SOLUTION</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*DQbkfuk8pscYxeIBcuvv_A.png" /></figure><p><a href="https://replit.com/@thequeenbeebs/RunLengthEncoding#script.js">https://replit.com/@thequeenbeebs/RunLengthEncoding</a></p><h3>THE METHOD TO MY MADNESS</h3><h4>Building Out Initial Variables</h4><pre>let count = 1<br>let finalString = string[0]</pre><p>The first thing I thought of when I saw this problem was that I was going to need to loop through each character in the string and create some sort of counter to determine the number of each character. I built a variable called “count” that would tell us the number of each character, and increment as we looped through the string.</p><p>I also wanted to create a string that would contain all of the final information that we would eventually return. The reason I didn’t begin by creating it as an empty string was that I knew that we would need something to compare to when looping through the input string, so I added the first character from the string. So, right now, using the example above, finalString would simply be “w”, and the count would be 1 to represent the 1 character we have already looped through.</p><h4>Looping through Each Character in the String</h4><pre>for (let i = 1; i &lt; string.length; i++) {<br>    ...<br>}</pre><p>For this loop, I decided to use this style of iteration instead of a for/in situation, because I knew that I actually wanted to just start with the second character in the string, and compare it to the first character already in our finalString variable.</p><h4>The Conditional: Part 1</h4><pre>if (string[i] === finalString[finalString.length - 1]) {</pre><pre>    count += 1</pre><pre>}</pre><p>So, what this conditional does is checks and sees if the current character in the loop is the same as the character before it, which we have added to our finalString and is currently the last character.</p><p>If we are still using our example from above, string[1] would be “w”, and finalString[0] would also be “w”. So, this conditional returns true and we add one more to the count.</p><h4>The Conditional: Part 2</h4><pre>else {</pre><pre>    finalString = finalString.slice(0, finalString.length - 1) +    </pre><pre>    count + finalString.slice(finalString.length - 1) + string[i]</pre><pre>    count = 1</pre><pre>}</pre><p>This is the part that gets a little tricky. What happens when we move on from one character to the next, when we’ve hit the 4th character in the string, “g”?</p><p>I’m sure there is a more elegant way to come up with a solution but the one I found is to slice up finalString like so:</p><pre>all the characters in the finalString except the last one</pre><pre>+</pre><pre>the counter we have been adding to </pre><pre>+ </pre><pre>the character we have been comparing the other characters with</pre><pre>+</pre><pre>the new character that we have come across, that we will now be using to compare against other characters</pre><p>It’s a little confusing, but this will give you the exact format you need for this problem. In this situation, if we put a console.log() inside this else conditional, the first one would come up as “3wg”. There is only one character in finalString at the moment, so there is nothing before the count, which is 3. After that we have the “w” that we have been referencing the whole time, and then the “g” that we will be referencing after that.</p><p>The last thing you need to do is reset the count variable to 1, since we are starting over and counting the instances of a new character.</p><h4>Tacking on the Final Count</h4><pre>finalString = finalString.slice(0, finalString.length - 1) + count + finalString.slice(finalString.length - 1)</pre><p>The only thing that this loop does not accomplish is that there will be still one more count that needs to be tacked onto the finalString after we have finished iterating. Like in the else conditional above, we are putting the count inside slices of finalString so it’s in the exact position that we need. The only thing that is different is that we are not tacking another character on the end of finalString, because we’ve looped through them all and there’s nothing else to compare!</p><p>Put this code outside of both the conditionals and the looping, so that it is only performed once right before we return the finalString.</p><h4>Return finalString</h4><pre>return finalString</pre><p>That’s it! You’re done!</p><p>I’m really interested in seeing other people’s solutions to this problem, so feel free to comment and let you know how you’d tackle run-length encoding. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27cd6c22a40e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Basics: The Random Module]]></title>
            <link>https://thequeenbeebs.medium.com/python-basics-the-random-module-54ce1baba373?source=rss-a4ebb4e6b0c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/54ce1baba373</guid>
            <category><![CDATA[random]]></category>
            <category><![CDATA[modules]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[thequeenbeebs]]></dc:creator>
            <pubDate>Thu, 02 Sep 2021 00:41:43 GMT</pubDate>
            <atom:updated>2021-09-02T00:41:43.902Z</atom:updated>
            <content:encoded><![CDATA[<h4>The thing that made me fall in love with Python.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HDqvMrYyt49NTCPi" /><figcaption>Photo by <a href="https://unsplash.com/@rocinante_11?utm_source=medium&amp;utm_medium=referral">Mick Haupt</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hey guys! As I mentioned <a href="https://thequeenbeebs.medium.com/5-simple-differences-between-javascript-and-python-399a9b0c0cbe">last week</a>, I have just started my journey learning Python. As with any new language it is a little slow going at first, but I have started picking up speed and have really started to fall in love with it. One of the things that was a game changer to me this week was being introduced to the Random module and all of the methods inside it that you can use! Today, I’m going to break down the Random module, show you how to add it to your application, and the most important and commonly used functions within it.</p><h3>What is Random?</h3><p>Random is a module in Python that generates pseudo-random numbers for various purposes. It’s been super great for all of the silly CLI games I’ve been building, but also has fabulous uses for real life as well.</p><h3>Importing Random</h3><p>Importing Random in your Python file is super simple, and similar to importing React components if that’s something you know how to do. At the top of your Python document, simply type:</p><pre>import random</pre><p>That’s it! Now you can call on all of the random functions that your heart desires. Let’s break down a few of them that I love now.</p><h3>Random Functions To Know</h3><h4>random.randint()</h4><p>This function is the most commonly used in terms of returning random numbers. The function has two parameters, that are the range, and the function will return a random integer inside that range.</p><pre>random.randint(1, 10) # returns a number between 1 and 10</pre><p>This function is great for any sort of application where you need to rely on chance. Rock, Paper, Scissors! Heads or Tails! Roulette! These are all things with an equal amount of probability where you can assign each choice to a number.</p><h4>random.random()</h4><p>This function doesn’t take any parameters, and returns a number between 0.0 and 1.0.</p><pre>random.random() # 0.3</pre><h4>random.choice()</h4><p>This is definitely my favorite of the random functions. It takes as its parameter a list, and will choose a random item from that list.</p><pre>fruits = [&quot;Apple&quot;, &quot;Pear&quot;, &quot;Banana&quot;, &quot;Peach&quot;, &quot;Plum&quot;]</pre><pre>random.choice(fruits) # &quot;Banana&quot;<br>random.choice(fruits) # &quot;Plum </pre><p>This is a way of creating an even simpler game of chance; instead of having to assign each selection to a number, you can create an array of all of the choices like so:</p><pre>choices = [&quot;Rock&quot;, &quot;Paper&quot;, &quot;Scissors&quot;]<br>random.choice(choices)</pre><h4>random.shuffle()</h4><p>Another great one for lists, random.shuffle() will take a list and mix it up into a random order. Let’s use the same fruits list from above:</p><pre>fruits = [&quot;Apple&quot;, &quot;Pear&quot;, &quot;Banana&quot;, &quot;Peach&quot;, &quot;Plum&quot;]</pre><pre>random.shuffle(fruits) # [&quot;Pear&quot;, &quot;Plum&quot;, &quot;Apple&quot;, &quot;Peach&quot;, &quot;Banana&quot;]</pre><p>These are the four functions that I have used the most, but there are plenty more. Check out more info about it in the Python <a href="https://docs.python.org/3/library/random.html">documentation</a>, and I also really like this explanation from <a href="https://www.w3schools.com/python/module_random.asp">W3Schools</a>. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54ce1baba373" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Simple Differences Between JavaScript and Python]]></title>
            <link>https://thequeenbeebs.medium.com/5-simple-differences-between-javascript-and-python-399a9b0c0cbe?source=rss-a4ebb4e6b0c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/399a9b0c0cbe</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <dc:creator><![CDATA[thequeenbeebs]]></dc:creator>
            <pubDate>Sat, 28 Aug 2021 22:53:42 GMT</pubDate>
            <atom:updated>2021-08-28T22:53:42.092Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IeF3_qZ7oXznEbgT" /><figcaption>Photo by <a href="https://unsplash.com/@davidclode?utm_source=medium&amp;utm_medium=referral">David Clode</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I have begun the exciting journey of learning my first language post-bootcamp: Python! A senior engineer friend of mine once described learning new coding languages as “more like learning a new accent rather than an entire language” and so far I completely agree. There are more similarities then differences: variables work the same, there are the same data types (strings, integers, booleans, floats, etc.), string interpolation works the same…the list goes on and on. Once you understand the basic foundation of one language, the next one comes to you much more quickly and easily.</p><p>However, there are always going to be differences, especially in syntax. After spending a lot of time with JavaScript, here are my 5 main takeaways of things I have found that are different between JS and Python so far:</p><h3>1. Print instead of console.log</h3><p>Need to print something to the console? No more console.logs; simply type the command print() with whatever you wanted printed inside the parentheses.</p><pre>print(&quot;Hello World&quot;) # Hello World</pre><p>P.S. Want to comment out code in Python? Simply use the pound/hash sign (#), just like with Ruby.</p><h3>2. Using Different Quotations in Strings is Crucial</h3><p>Using quotes inside a string? Make sure to use different quotations (for example, single quotes and double quotes) so the computer can properly understand what needs to be printed.</p><pre>print(&quot;Strings in Python are similar to strings in JavaScript, in that they are wrapped in quotation marks like so: &#39;Hello World&#39;&quot;) </pre><pre># Strings in Python are similar to strings in JavaScript, in that they are wrapped in quotation marks like so: &#39;Hello World&#39;</pre><h3>3. Use Underscores for Large Integers</h3><p>If you have a very large integer that you would usually separate with commas, you can use underscores for better readability. Simply place them wherever you would normally place commas, like so:</p><pre>large_int = 123_456_789<br>another_large_int = 1_000_000</pre><p>large_int is the same as writing 123,456,789. another_large_int is the same as writing 1,000,000. The computer ignores the underscores, but it is extremely helpful for human eyes when trying to read large numbers.</p><h3>4. Booleans begin with capitals.</h3><p>This one felt a little bizarre to me at first, because booleans in both Ruby and JavaScript are all lowercase. In Python, the first letter is capitalized:</p><pre>true_boolean = True<br>false_boolean = False</pre><h3>5. Division always returns a float.</h3><p>When performing division in Python, you use the same symbol as JavaScript (/). However, with Python, division will always return a float rather than a plain integer.</p><pre>print(10 / 5)   # 2.0</pre><p>Characteristics like this are the reason why Python is a great choice when building applications that require a lot of math.</p><p>These are my main takeaways from learning just a couple of different Python methods and being introduced to Python data types. I have been really enjoying learning Python through Dr. Angela Yu’s Python course on Udemy, which you can check out <a href="https://www.udemy.com/share/103IHM3@I5QVxpmuqiwc8f8pmTbj-i2mfjNeFQdXQRzO4zJVhRG2ufpu1OaxZEA1qvY2UFoEBw==/">here</a>. As always, the Python <a href="https://www.python.org">documentation</a> is also a great place to dig deeper. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=399a9b0c0cbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TestCafe Basics: Top 5 Actions to Interact with the Page]]></title>
            <link>https://thequeenbeebs.medium.com/testcafe-basics-top-5-actions-to-interact-with-the-page-73e66db27702?source=rss-a4ebb4e6b0c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/73e66db27702</guid>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[testcafe]]></category>
            <dc:creator><![CDATA[thequeenbeebs]]></dc:creator>
            <pubDate>Fri, 20 Aug 2021 21:30:29 GMT</pubDate>
            <atom:updated>2021-08-20T21:30:29.078Z</atom:updated>
            <content:encoded><![CDATA[<p>A couple of months ago, I began my journey of implementing testing into my projects and working with the automation framework TestCafe, and wrote an introductory blog that you can check out <a href="https://thequeenbeebs.medium.com/writing-my-first-test-a-journey-in-testcafe-and-automation-215ca2b9134d">here</a>. Today, I’m going to expand on what I discussed then and show y’all 5 important actions any TestCafe user should know.</p><p>To start, I’m going to remind you what the syntax of a TestCafe test looks like:</p><pre>test(&#39;name of your test here&#39;, async t =&gt; {</pre><pre>   // testcafe actions go in here </pre><pre>})</pre><p>Pretty simple. So, the actions are what we put inside of the function to instruct the test what to do on the web page. Most of them are pretty self explanatory, but I’m going to break down 5 of them now!</p><h3>Click</h3><p>Use this action when you want the test to click an element on the page. First step is to use the TestCafe Selector to find the element you are looking for, and then call on that like so:</p><pre>test(&#39;name of your test here&#39;, async t =&gt; {</pre><pre>   const button = Selector(&#39;#submit-button&#39;)<br>   await t.click(button)</pre><pre>})</pre><p>I’m not going to go into Selectors too much, but you can find out more about them <a href="https://testcafe.io/documentation/402829/guides/basic-guides/select-page-elements">here</a>. As I mentioned in my previous blog, make sure you import Selector at the top of your file, and then use a CSS selector to grab the element you seek. IDs are definitely the easiest to use in this situation!</p><h3>Type Text</h3><p>Like click, type text is pretty explanatory. The most frequent time it is used it is to make sure forms are working properly:</p><pre>test(&#39;name of your test here&#39;, async t =&gt; {</pre><pre>   const passwordInput = Selector(&#39;#password&#39;)<br>   await t.typeText(passwordInput, &#39;password1234&#39;)</pre><pre>})</pre><p>With type text, the action takes two arguments: the first is the selector we want to type text into, and the second is the string that we would like to be entered.</p><h3>Press Key</h3><p>The press key action enables the test to press a key of your choice. This can be either a letter, a number, or anything on the keyboard!</p><pre>test(&#39;name of your test here&#39;, async t =&gt; {</pre><pre>   await t.pressKey(&#39;enter&#39;)</pre><pre>})</pre><p>There’s only one argument for pressKey: the key you want to be pressed!</p><h3>Hover</h3><p>A hover actions tells the test to hover your mouse over a certain element. Perhaps you want a button to change colors when you hover over it:</p><pre>test(&#39;name of your test here&#39;, async t =&gt; {</pre><pre>   const colorChangeButton = Selector(&#39;#color-change-button&#39;)<br>   await t.hover(colorChangeButton)</pre><pre>})</pre><p>Like the click action, the only argument you need is the selector of the element you want to hover over.</p><h3>Navigate</h3><p>The navigateTo action is very helpful if you want to navigate to a new URL in the middle of a test:</p><pre>test(&#39;name of your test here&#39;, async t =&gt; {</pre><pre>   await t.navigateTo(&#39;http://www.blairebaker.com&#39;)</pre><pre>})</pre><p>The URL you want to navigate to is the only parameter, so in the example above you would be navigating to my faaaaabulous website.</p><p>These are the ones that you are most likely to use, but there are plenty more. Read more about them in the super helpful <a href="https://testcafe.io/documentation/402833/guides/basic-guides/interact-with-the-page">TestCafe documentation</a>. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73e66db27702" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling Image Errors in React]]></title>
            <link>https://thequeenbeebs.medium.com/handling-image-errors-in-react-cc390df7bc80?source=rss-a4ebb4e6b0c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc390df7bc80</guid>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[thequeenbeebs]]></dc:creator>
            <pubDate>Wed, 11 Aug 2021 22:25:07 GMT</pubDate>
            <atom:updated>2021-08-11T22:25:07.714Z</atom:updated>
            <content:encoded><![CDATA[<p>While working on a take-home assessment this week, I encountered an issue that I’d never thought of before: what happens when an image src is broken?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*JSehLO-i1Q6ZoeWdFj2YEA.png" /></figure><p>It’s not cute. Also, if you are using any sort of formatting or styling on your page, it can really throw a wrench into all of it.</p><p>For my take-home assessment, one of the tasks required me to iterate through some data and create a “team roster,” which each team member having a card that contained a profile picture, along with their name, title, and bio. I wanted all of the images to be a consistent size, which worked beautifully with CSS until…I realized one of the image src URLs was broken. The broken image icon of doom showed up on the screen and messed up all of my hard work and formatting.</p><p>What is a poor programmer to do? Here, I’m going to step through the process of fixing this little problem in your React applications!</p><h3>Step 1: Choose a Default Image</h3><p>Decide on the default image that will replace the SRC if your image is broken! You can choose whatever you like: the silhouette of a head, an “oops this image is broken sign,” or even a corgi with its snoot in the middle of a slice of bread:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*94SsFbivh18YNKuiTEIkmA.jpeg" /></figure><p>With a face like that, who cares if the image is broken, right?</p><h3>Step 2: Make Sure to Always Include an Alt Property</h3><p>This is common knowledge, but I just wanted to remind you to always include the alt property in all img tags you use. This is important not only for situations where the image is broken, but it is also crucial for screen readers to make your application more accessible. If you’re not familiar, this is what it looks like:</p><pre>&lt;img src=&quot;www.dog-pics.com&quot; alt=&quot;funny picture of a corgi&quot;&gt;</pre><h3>Step 3: Create Function to Call on Default Image</h3><p>Now, we’re going to create a function inside our React component that will change the SRC to our selected default image.</p><pre>const addDefaultImg = ev =&gt; {<br>   ev.target.src = &quot;default-dog.jpg&quot;<br>}</pre><p>This function, addDefaultImg, takes an event (an image tag), and changes the src to the default image you have already selected. Pretty simple!</p><h3>Step 4: Use onError to Call on Function</h3><p>In order to call on that function, we are going to use the onError property that React has in its framework, which is called every time there is an error when a tag is rendered (i.e. when the src is broken). Check it out:</p><pre>&lt;img src=&quot;www.dog-pics.com&quot; alt=&quot;funny picture of a corgi&quot; onError={addDefaultImg}&gt;</pre><p>Note: I used all functional components. If using a class component, make sure to use this.addDefaultImg.</p><p>And that’s it! A super quick way to add a default image in case one of yours breaks and you don’t catch it quickly. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc390df7bc80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using localStorage in React Applications]]></title>
            <link>https://thequeenbeebs.medium.com/using-localstorage-in-react-applications-8f39122a16b7?source=rss-a4ebb4e6b0c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f39122a16b7</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[localstorage]]></category>
            <dc:creator><![CDATA[thequeenbeebs]]></dc:creator>
            <pubDate>Sun, 08 Aug 2021 00:34:59 GMT</pubDate>
            <atom:updated>2021-08-08T00:34:59.441Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4DhS8n11Hegk4q25" /><figcaption>Photo by <a href="https://unsplash.com/@flowforfrank?utm_source=medium&amp;utm_medium=referral">Ferenc Almasi</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Who can remember all of our usernames and passwords these days anyways? Those “Remember Me” checkboxes at the bottom of login forms have really come in handy in this day and age, and the way that is done is by saving that sort of data on the user’s machine. A simple way to do that is through localStorage! Today, I’m going to walk through exactly what localStorage is, how to find it on your DevTools, and a couple of important functions in order to implement it into your own React applications.</p><h3>What is localStorage?</h3><p>My favorite definition is from <a href="https://blog.logrocket.com/localstorage-javascript-complete-guide/">LogRocket</a>:</p><pre>localStorage is a property that allows JavaScript sites and apps to save key-value pairs in a web browser with no expiration date. This means the data stored in the browser will persist even after the browser window is closed.</pre><p>In the past, I have only used localStorage for authorization and authentication usage, but this week I was given a take-home assignment for a company that asked me to keep the state on my application persistent “even if the server has restarted.” I know there are probably more secure ways to handle such problems, but I knew that localStorage would be there in a pinch to help me out!</p><h3>Finding localStorage in your DevTools</h3><p>For me, the thing that really helped me understand localStorage and how it works was to find and play with it in my DevTools! Of course every browser is going to be different, but today I will walk you through finding it on Google Chrome.</p><h4>1. Right click on your application, and select “Inspect”</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRCK6asV6DiWZJMqHE2BFA.png" /></figure><h4>2. Click on the &gt;&gt; dropdown menu and then select Application.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJF5aJi4h15L1MYDkAOYVQ.png" /></figure><h4>3. Click on the localStorage button to see all of the key-value pairs!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*rk3H1TNMFACV17KNV94Uew.png" /></figure><p>There you have it! This really comes in handy with debugging and making sure your localStorage is working like you’d like it to! Now, let’s move on to a couple of commonly used methods in order to implement localStorage in your application.</p><h3>localStorage.setItem()</h3><p>localStorage.setItem adds a key and value pair to your localStorage, taking two arguments like so:</p><pre>localStorage.setItem(&#39;name&#39;, &#39;Blaire&#39;);</pre><p>In this instance, it would save the string ‘Blaire’ in localStorage under the key of ‘name’.</p><h3>localStorage.getItem()</h3><p>Now, let’s say we want to retrieve a piece of useful information from localStorage…we would use the getItem method, which use takes just one argument: a key.</p><pre>localStorage.getItem(&#39;name&#39;) /// &#39;Blaire&#39;</pre><p>Now, we are calling on localStorage and asking it to return the value that is signed to a particular value. Not too difficult, right?</p><h3>Putting It All Together</h3><p>Now, I’m going to show you a bit of how I used localStorage in action!</p><p>What I wanted to do was check and see if localStorage already had a value connected to the key of userData. If it did, I would set my state to that value. If not, I would make a fetch request to the API to get the data I needed. This is how I did it:</p><pre>useEffect(() =&gt; {</pre><pre>   if (localStorage.getItem(&#39;userData&#39;)) {</pre><pre>      setUserData(JSON.parse(localStorage.userData))</pre><pre>   } else {</pre><pre>      fetch(`http://localhost:3000/users/${userId}`)</pre><pre>         .then(resp =&gt; resp.json())</pre><pre>         .then(data =&gt; {</pre><pre>            setUserData(data)</pre><pre>            localStorage.setItem(&#39;userData&#39;, JSON.stringify(data))</pre><pre>      })</pre><pre>   }</pre><pre>}, [])</pre><p>HINT: localStorage can only take strings for values. If you need to use another data type, like I did with an array of objects, all you need to do call on JSON.stringify() to turn that array into a string, and parse that string when you get it back!</p><p>Play around with it, and make sure to take advantage of your DevTools when debugging. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f39122a16b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cracking the Code Challenge: Fun with Anagrams]]></title>
            <link>https://thequeenbeebs.medium.com/cracking-the-code-challenge-fun-with-anagrams-31b8832d9d4e?source=rss-a4ebb4e6b0c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/31b8832d9d4e</guid>
            <category><![CDATA[code]]></category>
            <category><![CDATA[code-challenge]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[thequeenbeebs]]></dc:creator>
            <pubDate>Thu, 29 Jul 2021 22:52:24 GMT</pubDate>
            <atom:updated>2021-07-29T22:52:24.407Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cJv6yfK33gRp3hD7" /><figcaption>Photo by <a href="https://unsplash.com/@altumcode?utm_source=medium&amp;utm_medium=referral">AltumCode</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>During my job search process for junior software engineering positions, I frequently am asked to tackle code challenges to demonstrate my knowledge and ability to potential employers. My jaw just about dropped to the floor when I realized I was encountering the <em>exact same</em> <a href="https://www.hackerrank.com/">HackerRank</a> problem twice in one week. I wasn’t able to solve it in time during the first attempt, but was very pleased to pass all of the tests the second time around.</p><p>Since I am imagining I will encounter this problem again, I figured I would break down my solution and try and help other junior developers.</p><p>Note: I’m sure this is not the most efficient solution, this is just what I logically came up with in a limited amount of time!</p><h3>THE PROBLEM</h3><blockquote>Given an array of strings, remove each string that is an anagram of an earlier string, then return the remaining array in sorted order.</blockquote><blockquote><strong>Example</strong></blockquote><blockquote>str = [&#39;code&#39;, &#39;doce&#39;, &#39;ecod&#39;, &#39;framer&#39;, &#39;frame&#39;]</blockquote><blockquote>code and doce are anagrams. Remove doce from the array and keep the first occurrence code in the array.</blockquote><blockquote>code and ecod are anagrams. Remove ecod from the array and keep the first occurrence code in the array.</blockquote><blockquote>code and framer are not anagrams. Keep both strings in the array.</blockquote><blockquote>framer and frame are not anagrams due to the extra r in framer. Keep both strings in the array.</blockquote><blockquote>Order the remaining strings in ascending order: [&#39;code&#39;,&#39;frame&#39;,&#39;framer&#39;].</blockquote><h3>MY SOLUTION</h3><pre>function funWithAnagrams(array) {</pre><pre>   let sortedArray = array.map(string =&gt;       <br>      string.split(&#39;&#39;).sort().join(&#39;&#39;))</pre><pre>   let firstAnagram = [sortedArray[0]]</pre><pre>   let indices = [0]</pre><pre>   let results = []</pre><pre>   for (let i = 1; i &lt; sortedArray.length; i++) {</pre><pre>      if (firstAnagram.includes(sortedArray[i])) {</pre><pre>      } else {</pre><pre>         firstAnagram.push(sortedArray[i])</pre><pre>         indices.push(i)</pre><pre>      }</pre><pre>   }</pre><pre>   indices.forEach(index =&gt; {</pre><pre>      results.push(array[index])</pre><pre>   })</pre><pre>   return results.sort()</pre><pre>}</pre><h3>THE METHOD TO MY MADNESS</h3><p>Now, I’m going to attempt to break down my code line by line and explain how this problem works.</p><h4>sortedArray</h4><p>The first thing I did was create sortedArray, where I took the input array, split it by characters, sorted those characters in alphabetical order, and then joined them back together. If you used the example above, sortedArray would look a little like this:</p><pre>[&#39;cdeo&#39;, &#39;cdeo&#39;, &#39;cdeo&#39;, &#39;aefmrr&#39;, &#39;aefmr&#39;]</pre><p>Now, I can clearly see which strings are anagrams of each other.</p><h4>firstAnagram and indeces</h4><p>These are both arrays that we are going to push items into when we are looping through our sorted array; indeces will contain the indeces of each string where an anagram is seen for the first time, and firstAnagram will contain each anagram we come across. For now, we put 0 in the indeces and the instance of sortedArray[0] into firstAnagram, as we need something to compare to in our loop, and this function will always return the first item in the array.</p><h4>Looping Through sortedArray</h4><p>This is a pretty basic for loop, with the exception that we are starting with i = 1, because the string at index 0 is already included.</p><h4>If/Else Conditional</h4><p>Now, this logic is a little out there but try to follow me on this one. Using the array.includes() method, I check and see if the firstAnagram array contains the string found at sortedArray[i].</p><p>If the firstAnagram array already includes that string, I don’t want to do anything: we already have an earlier string that is an anagram, so that one will be omitted.</p><p>However, if firstAnagram does <em>not</em> include that string, we should add it to the firstAnagram array, and also add the index of that string to the indeces array. I do both of these in the else statement using the array.push() method.</p><h4>Looping Through indeces</h4><p>Now, we will have an array, indeces, that contains the index of each first instance of an anagram! In the above example, it would look like this:</p><pre>[0, 3, 4]</pre><p>Now, we need to take the strings at the corresponding indeces from the original input array. I created an empty array at the top of the function called results. So, using a forEach loop, we will loop through the indeces array, and push the corresponding string from the input array onto our results array.</p><h4>Sorting</h4><p>Last but not least, the problem asked us to return the array in sorted order. Because this is simply strings, always we have to do is return results.sort().</p><p>So, there we have it! Let me know if any of this is still confusing and I will try to break it down for you. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31b8832d9d4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Embed Videos Using HTML]]></title>
            <link>https://thequeenbeebs.medium.com/how-to-embed-videos-using-html-f9613b916fea?source=rss-a4ebb4e6b0c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9613b916fea</guid>
            <category><![CDATA[medium]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[youtube]]></category>
            <dc:creator><![CDATA[thequeenbeebs]]></dc:creator>
            <pubDate>Mon, 26 Jul 2021 03:15:02 GMT</pubDate>
            <atom:updated>2021-07-26T03:15:02.268Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i8cdCQOFYocZE-zI" /><figcaption>Photo by <a href="https://unsplash.com/@jakobowens1?utm_source=medium&amp;utm_medium=referral">Jakob Owens</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I am very excited to be almost done building out my personal portfolio page and deploying it for the world to see. One of my last steps is posting information about the projects I have completed to show off my work, and I want to embed the demo videos I made that walk through my projects. I’m sure I’m not the first or the last that will do this, so I’m going to walk through some steps to get your videos up as quickly and painlessly as possible.</p><h3>1. Upload your videos to YouTube.</h3><p>If you haven’t done this before, it’s pretty simple! Log in to your YouTube account (or create one if you haven’t already). There’s a button on the upper right hand corner of the page that looks like a camera with a plus sign on it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FVsPA68R8AwO_K8HlqH3OA.png" /></figure><p>Click on that, then the upload video button, and the page should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wHweROfndhu0dEQDmOhupg.png" /></figure><p>Now, you can drag and drop your video file and it will upload to YouTube! Easy as pie.</p><h3>2. Use the &lt;iframe&gt; element on your HTML page.</h3><p>The &lt;iframe&gt; HTML tag stands for “inline frame,” and is used to embed another document within your HTML file. This is the tag that you will use to embed your video.</p><pre>&lt;iframe&gt;&lt;/iframe&gt;</pre><h3>3. Point the src attribute to the URL of your YouTube video.</h3><pre>&lt;iframe src=&quot;<a href="https://www.youtube.com/embed/hhK7M_CAPAU">https://www.youtube.com/embed/hhK7M_CAPAU</a>&quot;&gt;&lt;/iframe&gt;</pre><h3>4. Insert width and height attributes.</h3><pre>&lt;iframe src=&quot;<a href="https://www.youtube.com/embed/hhK7M_CAPAU">https://www.youtube.com/embed/hhK7M_CAPAU</a>&quot; width=&quot;560&quot; height=&quot;315&quot;&gt;&lt;/iframe&gt;</pre><h3>5. Add other attributes as needed.</h3><p>There’s quite a few other parameters that you can add to the &lt;iframe&gt; tag, including:</p><ul><li>allowfullscreen: allows a user to expand the YouTube video to take up the entire screen of their computer</li><li>URL parameters: in the SRC attribute, you can also add parameters. Check out more details at <a href="https://www.w3schools.com/html/html_youtube.asp">this W3Schools article</a>. Here is an example of the same &lt;iframe&gt; tag as above, but with a video that starts automatically and muted:</li></ul><pre>&lt;iframe src=&quot;<a href="https://www.youtube.com/embed/hhK7M_CAPAU">https://www.youtube.com/embed/hhK7M_CAPAU</a>?autoplay=1&amp;mute=1&quot; width=&quot;560&quot; height=&quot;315&quot;&gt;&lt;/iframe&gt;</pre><p>Hint: Always add a question mark after the URL, and separate each parameter with an ampersand.</p><p>And it’s that simple! Uploading media to your projects are much easier than you’d think, especially with easy-to-use video hosting platforms like YouTube. Hope this helps you take you projects to the next level!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9613b916fea" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>