<?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 Website Developer on Medium]]></title>
        <description><![CDATA[Stories by Website Developer on Medium]]></description>
        <link>https://medium.com/@seattlewebsitedevelopers?source=rss-eb6b2acff1ef------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vQyFaO89Wi1MiC-I_WN5lA.jpeg</url>
            <title>Stories by Website Developer on Medium</title>
            <link>https://medium.com/@seattlewebsitedevelopers?source=rss-eb6b2acff1ef------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 18 May 2026 06:31:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@seattlewebsitedevelopers/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[Enhancing Python Code Readability]]></title>
            <link>https://seattlewebsitedevelopers.medium.com/enhancing-python-code-readability-30d48b763274?source=rss-eb6b2acff1ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/30d48b763274</guid>
            <category><![CDATA[python-coding]]></category>
            <category><![CDATA[improve-code-readability]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming-tips]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Website Developer]]></dc:creator>
            <pubDate>Mon, 03 Feb 2025 12:24:11 GMT</pubDate>
            <atom:updated>2025-02-03T12:24:11.365Z</atom:updated>
            <content:encoded><![CDATA[<h4>5 Enjoyable Strategies and Why They Matter!</h4><p>Anyone entering the realm of programming must understand how important it is to write code that is easy to read. Clear and understandable code does not promote teamwork. It also makes it easier to troubleshoot and manage software projects. In this article, we’ll explore five strategies to improve the readability of <a href="https://visualwebz.com/python/">Python</a> code, making programming more user-friendly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*gMOv8RIJvXLb_uDwA-ccLw.png" /></figure><h3>Challenges and common difficulties encountered.</h3><p>When writing code for beginners in programming, it’s common to face readability challenges. These can include using names that don’t explain their purpose, lacking comments to describe the code logic, having inconsistent indentation that hampers understanding the structure of the code, and dealing with long and complex code blocks called monolithic structures. These issues make it hard for others to grasp the code and hinder the coder’s ability to maintain and debug their work effectively. Resolving these readability challenges is crucial for creating a programming environment and ensuring software projects are sustainable in the long run.</p><h3>Using Descriptive Variable Names:</h3><p>When writing Python code, choosing descriptive names for your variables is crucial. Variables play a role in a program. Opting for meaningful names dramatically improves the code’s readability. When using abbreviations or single letters, it’s best to select names that accurately describe what the variables represent and what they do in the program. For example, rather than using something like “td” for distance, a more descriptive name such as “total distance” makes it easier to understand the purpose of that variable. This idea is also highlighted in Robert C. Martin’s well-known book <a href="https://thixalongmy.haugiang.gov.vn/media/1175/clean_code.pdf">“Clean Code,”</a> where he stresses how critical descriptive names are in making code easier to read and maintain. Martin suggests that clear names act as self-labels, helping <a href="https://seattlewebsitedeveloper.com/">developers</a> grasp the meaning of variables without requiring comments or explanations.</p><pre># Bad variable names<br>a = 10<br>b = 5<br>c = a + b<br>print(c)<br># Improved variable names<br>Total_score = 10<br>bonus_points = 5<br>final_score = total_score + bonus_points<br>print(final_score)</pre><p>In the improved version, the variable names total_score, bonus_points, and final_score convey their purpose, making the code much easier to understand.</p><h3>Incorporating Well- commented code</h3><p>When it comes to writing code, adding comments is essential. Comments help document the code and explain how it works. They give insight into the developer’s thinking process. Make complex algorithms or logic easier to understand for others. Good commenting means explaining why certain decisions were made, or specific methods were chosen. Making comments clear, relevant, and regularly updated is crucial so they stay valuable and informative. <a href="https://www.python.org/dev/peps/pep-0008/">In Python’s style guide, PEP 8,</a> suggests using comments and focusing on explaining the reasoning behind the code rather than just what it does. By including commented code, developers can enhance collaboration. Promote knowledge sharing within their team. Commented code also acts as a form of documentation for maintenance or improvements, helping developers grasp the details of the codebase as it evolves. According to Jason Cohen, founder of WP Engine and author of <a href="https://www.yumpu.com/en/document/read/19324443/best-kept-secrets-of-peer-code-review-pdf-smartbear">“Best Kept Secrets of Peer Code Review,”</a> comments should not describe the code’s actions. Also, explain why it is done a certain way, aiding in understanding the choices made during implementation.</p><pre># Bad example: Lack of comments<br>def calculate_price(quantity, price_per_unit):<br>total_price = quantity * price_per_unit<br>return total_price<br># Improved example: With comments<br>def calculate_price(quantity, price_per_unit):<br># Calculate the total price based on quantity and price per unit<br>total_price = quantity * price_per_unit<br>return total_price</pre><p>In the improved version, the comment clarifies the function’s purpose, making it easier for others to understand its functionality.</p><h3>Ensuring indentation and formatting</h3><p>Maintaining indentation and formatting is crucial in software development. It ensures that code remains easy to read, consistent, and collaborative. Python, known for its use of indentation to structure code blocks, highlights the importance of following a formatting style across a codebase. Coding standards, like PEP 8, underscore this importance. They provide guidance on the formatting of Python coding elements such as spacing and general coding style.</p><p>In “Clean Code,” Robert C. Martin stresses the importance of uniform formatting in enhancing code readability and sustainability. By adhering to a format, programmers can streamline the tasks of comprehending, altering, and troubleshooting code for their coworkers. Additionally, tools like AutoPep8 automate the enforcement of coding standards, making it simpler for teams to uphold practices.</p><p>Consistent indentation and formatting do not enhance code readability. Also, it contributes to a polished appearance for the entire codebase. An organized and neatly formatted collection of code reflects positively on individual developers and elevates the project’s overall image. stresses the importance of uniform formatting in enhancing code readability and sustainability. By adhering to a format, programmers can streamline the tasks of comprehending, altering, and troubleshooting code for both themselves and their coworkers. Adhering to practices and utilizing tools to uphold coding guidelines enables developers to build codebases that are not just user-friendly but also trustworthy and polished.</p><p>For example,</p><pre># Bad indentation<br>def greet(name):<br>print (&quot;Hello, &quot; + name + &quot;!&quot;)<br># Improved indentation<br>def greet(name):<br>print (&quot;Hello, &quot; + name + &quot;!&quot;)</pre><p>In the improved version, the code is properly indented, making the function’s structure clear.</p><h3>Embracing Modularization and Functions</h3><p>To create code that’s simple to understand and update, it is important to adopt modularization and focus on function-based programming. This Strategy, advocated by Robert C. Martin in his book <a href="https://thixalongmy.haugiang.gov.vn/media/1175/clean_code.pdf">“Clean Code:</a> A Handbook of Agile Software Craftsmanship,”entails dividing tasks into functions to improve clarity and ease of upkeep.</p><p>By following this method, developers can improve code organization and clarity by structuring systems into components. Imagine a scenario where a sophisticated application is divided into modules, each handling functionalities like user authentication, data processing, and user interface rendering in a <a href="https://visualwebz.com/web-development/">web application</a>. This modular design simplifies development. It makes it easier to manage aspects of the codebase effectively.</p><p>Moreover, encapsulating functionality within functions allows developers to create components that are easily integrated into parts of the codebase. This practice promotes efficiency by minimizing redundancy and encouraging code reuse. Additionally, modularization simplifies — debugging tasks. When functionality modifications or fixes are needed, developers can focus on the module or function without sifting through extensive amounts of code. This targeted approach streamlines development efforts while reducing the chances of consequences. The use of modular design encourages teamwork among developers. By establishing divisions between modules and defined interfaces, team members can tackle various sections of the code simultaneously without interfering with each other’s work. This nurtures a cooperative development approach, resulting in improved project outcomes.</p><pre># Monolithic approach<br>def calculate_total_price(quantity, price_per_unit, tax_rate):<br>total_price = quantity * price_per_unit<br>total_price_with_tax = total_price * (1 + tax_rate)<br>return total_price_with_tax<br># Modular approach<br>def calculate_subtotal(quantity, price_per_unit):<br>return quantity * price_per_unit<br>def calculate_total_price(subtotal, tax_rate):<br>return subtotal * (1 + tax_rate)</pre><p>The modular approach divides the functionality into separate functions, making the code easier to understand and maintain.</p><h3>Meaningful function name</h3><p>The importance of choosing clear function names goes beyond using variable names. Function names make code readable by providing an overview of what each block of code does without the need to dig into the details. Let’s explore why having function names is crucial and how they enhance the readability of code. When naming functions, it’s vital to pick names that accurately describe their purpose or the task they perform. In his book <a href="https://books.google.com/books/about/Clean_Code_in_Python.html?id=ZB9sDwAAQBAJ&amp;printsec=frontcover&amp;source=kp_read_button&amp;hl=en&amp;newbks=1&amp;newbks_redir=0&amp;gboemv=1&amp;ovdme=1#v=onepage&amp;q&amp;f=false">“Clean Code in Python: Refactor Your Legacy Code Base,”</a> Mariano Anaya, stresses the importance of selecting function names. According to Mariano, these names act as documentation for the code, helping developers grasp the intention behind each function without having to analyze its implementation details. This is especially beneficial when working on projects or collaborating with developers since clear and descriptive function names aid communication and reduce the mental effort needed to understand the codebase.</p><p>Moreover, Mariano suggests that meaningful function names contribute to creating self-code, which makes it simpler for developers to maintain and modify the code in the future. When functions are given meaningful names, it becomes easier for developers to pinpoint the function they need to use when adding new features or resolving issues. This ultimately streamlines the development process. It makes it more efficient.</p><p>For example:</p><pre># Bad function name<br>def xyz(a, b):<br>return a + b<br># Improved function name<br>def calculate_sum(a, b):<br>return a + b</pre><p>In the improved version, the function name calculate_sum communicates its purpose, enhancing the readability of the code.</p><h3>Final Thoughts</h3><p>Improving the readability of Python code is about more than aesthetics — it fosters teamwork, streamlines problem-solving, and ensures a project’s long-term success. By addressing readability challenges and using strategies like clear variable names, thorough comments, consistent formatting, modular functions, and meaningful function names, developers can make their code significantly more manageable and accessible.</p><p>Today, developers can also leverage artificial intelligence to improve coding readability. AI-powered tools, such as intelligent code linters and refactoring assistants, automatically detect inefficiencies, suggest improvements, and enforce best practices. These tools enhance individual coding quality, save valuable time, reduce maintenance burdens, and promote uniformity across team projects. AI-driven code completion tools, like GitHub Copilot, further improve productivity by generating clean, readable code snippets based on developer inputs.</p><p>As thought leaders like Robert C. Martin and Mariano Anaya emphasize, better readability isn’t just about writing but collaboration, scalability, and project sustainability. Combining fundamental best practices with AI-driven solutions empowers developers to create Python projects that are not only functional but also intuitive, sustainable, and future-ready.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30d48b763274" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding ACC and Its Evolution]]></title>
            <link>https://seattlewebsitedevelopers.medium.com/understanding-acc-and-its-evolution-c6ba1d6be83d?source=rss-eb6b2acff1ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6ba1d6be83d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cac]]></category>
            <category><![CDATA[msdos-programming]]></category>
            <category><![CDATA[program]]></category>
            <category><![CDATA[programming-languages]]></category>
            <dc:creator><![CDATA[Website Developer]]></dc:creator>
            <pubDate>Mon, 03 Feb 2025 12:11:35 GMT</pubDate>
            <atom:updated>2025-02-03T12:11:35.338Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://en.wikipedia.org/wiki/ACC_(programming_language)">ACC is a programming language</a> primarily known as a compiler. To clarify, <strong>a compiler</strong> is a program that translates code written in one programming language (the source language) into another (the target language). The term “compiler” typically refers to software that converts high-level programming languages into a lower-level language, often machine code, to ensure compatibility with the underlying hardware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*0L_Nr4vKjQcPUGjlRJwOdw.png" /></figure><p>Initially, ACC was designed to run on <strong>MS-DOS</strong> (Microsoft Disk Operating System), specifically on PCs with Intel 80386 processors or newer versions. MS-DOS, the dominant operating system in the 1980s, played a pivotal role in Microsoft’s rise in the software industry. However, its complexity made it less user-friendly than Apple’s Macintosh operating system, eventually leading to MS-DOS losing market appeal. This shift also contributed to the decline in the popularity of tools like ACC, relegating the language to obscurity over time.</p><h3>Benefits and Limitations of ACC</h3><h4>Benefits</h4><p>ACC offers several benefits that make it appealing for its time:</p><ul><li><strong>Simplicity</strong>: The language uses straightforward commands, often comprised of just 1–3 letters, making it accessible for beginners.</li><li><strong>Speed and Size</strong>: ACC compilers were known for their small size and fast execution, providing efficiency on resource-constrained systems.</li><li><strong>Ease of Learning</strong>: Its intuitive structure meant even novice programmers could quickly pick up the basics, including simple tasks like printing text or color on a screen.</li></ul><h4>Limitations</h4><p>However, ACC’s simplicity also results in several significant limitations:</p><ul><li><strong>Lack of Advanced Functionality</strong>: ACC lacks the complexity needed for modern programming tasks, such as building sophisticated software applications or games.</li><li><strong>Limited Features</strong>: There’s no ability to handle advanced graphics, like sprites, which restricts its utility in areas beyond basic scripting.</li><li><strong>Overlapping Functionality</strong>: Languages like <strong>Batch</strong> offer nearly identical functionality, diminishing ACC’s unique value proposition.</li></ul><p>Given these limitations, ACC became obsolete for most practical purposes as more versatile and robust programming languages emerged.</p><h3>Current Usage and Relevance of ACC</h3><p>Today, ACC has effectively fallen out of use in any mainstream capacity. Historically, it was part of the <strong>C programming language family</strong> — a group of languages stemming from the foundational “C” language itself. <a href="https://seattlewebsitedesign.medium.com/superstar-programmers-f4d437033379">Early programmers</a> mainly used ACC for tasks such as merging multiple object files.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FPxmvTsrCTZg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DPxmvTsrCTZg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FPxmvTsrCTZg%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c25117bb2df6344916e1fea39ad0adc/href">https://medium.com/media/5c25117bb2df6344916e1fea39ad0adc/href</a></iframe><p>While there are some mentions of ACC being used on <strong>HP-UX machines</strong> as a compiler, its application is now largely anecdotal or limited to historical discussions. Modern programming needs have vastly outpaced what ACC was designed to accomplish. Today, languages like Python, JavaScript, C++, and others dominate due to their adaptability, modern library support, and ability to handle complex tasks.</p><h3>Example of ACC Code</h3><p>Despite its simplicity, ACC’s coding structure offers a glimpse of how early <a href="https://seattlewebsitedesign.medium.com/top-programming-languages-to-know-and-why-689acccb24ed">programming languages</a> functioned. Below are two examples demonstrating an IF statement and a loop in ACC:</p><h4>IF Statement Example:</h4><pre>```<br>#include &lt;iostream.h&gt;<br>int main() {<br>int x, y;<br>cout &lt;&lt; &quot;Enter an integer: &quot;;<br>cin &gt;&gt; x;<br>y = x * 2;<br>cout &lt;&lt; &quot;\n&quot; &lt;&lt; y &lt;&lt; &quot; is twice &quot; &lt;&lt; x &lt;&lt; &quot;.\n&quot;;<br>}<br>```</pre><h4>Loop Example:</h4><pre>```<br>x_inv = 1.0/x;<br>for (int j = 1; j &lt; 5; j++)<br>a[j] = b[j] * x_inv;<br>```</pre><p>These examples highlight ACC’s straightforward syntax and inherent limitations in handling advanced functionality.</p><h3>Trends in ACC’s Legacy</h3><p>ACC never experienced widespread popularity, even during its peak in the 1980s. Its decline coincided with the rise of user-friendly operating systems like Macintosh, which overshadowed MS-DOS and eliminated the ecosystem where ACC thrived. Furthermore, the rapid evolution of programming languages left little room for a simplistic tool like ACC in a world shifting towards more sophisticated and versatile solutions.</p><h3>Final Thoughts</h3><p>While ACC is historically significant as part of the early evolution of compilers and <a href="https://visualwebz.com/website-developer-tools/">programming tools</a>, it has little to no relevance in the modern technological landscape. Adopting modern solutions like Python or using advanced AI-powered programming assistants is essential for businesses and developers seeking cutting-edge tools. These tools embody the flexibility and functionality required to effectively tackle today’s complex programming challenges.</p><p>For those interested in archival programming history or understanding the early evolution of compilers, ACC serves as a fascinating case study of how technology evolves to meet users’ demands.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6ba1d6be83d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Recursion]]></title>
            <link>https://seattlewebsitedevelopers.medium.com/understanding-recursion-b7b91c7c0f3b?source=rss-eb6b2acff1ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7b91c7c0f3b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[what-is-recursion]]></category>
            <category><![CDATA[recursion-python]]></category>
            <category><![CDATA[recursion]]></category>
            <dc:creator><![CDATA[Website Developer]]></dc:creator>
            <pubDate>Mon, 15 Jan 2024 22:07:13 GMT</pubDate>
            <atom:updated>2024-01-15T22:07:13.528Z</atom:updated>
            <content:encoded><![CDATA[<h4>What Is Recursion?</h4><p>In definition terms, a <a href="https://www.geeksforgeeks.org/recursion/#:~:text=The%20process%20in%20which%20a,%20can%20be%20solved%20quite%20easily.">Recursion</a> is a process of a function that calls itself “directly” or “indirectly”. Or in other terms, a function that calls itself is recursive; hence where the term recursion came from is the act of using that function. As for the history of recursions, it is best to talk about what the word means. Recursions come from the Latin word ‘Recurere’ as in to run or hasten back, return, revert, or recur. Like most functions in Python or coding in general, recursions are a technique to help you reduce the length of your code and make your code easy to read or write.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/0*ga-K5UHSV9bixW2T.gif" /><figcaption><a href="https://giphy.com/explore/recursive-animation">https://giphy.com/explore/recursive-animation</a></figcaption></figure><p>In more basic terms, you can break down a code and make It into smaller parts or create more minor problems you can solve.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F9bsK03SlmNM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9bsK03SlmNM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F9bsK03SlmNM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/486adf016178e2ad3d379cfa6f88f70d/href">https://medium.com/media/486adf016178e2ad3d379cfa6f88f70d/href</a></iframe><h3>Examples</h3><p>I know what you think. If Recursion is just a function to repeat itself on and on in a program, couldn’t the code continue and never stop creating the same code? Possibly creating an infinite code and wasting all your memory in your computer. Yes, you are correct, but that is why there is a Recursion error. For instance, as simple as code like:</p><pre>Def function():<br>X = 10<br>function()</pre><p>Based on that code, your computer can only interpret and act on that code so many times it has a limit, so it will just give you a “RecursionError”. The idea is that recursions help you demonstrate your problem in one or smaller issues so you can add one or more base conditions to stop your problem. A notable example of this is when you want to add numbers to each on a function like “f(n) = 1 + 2 + 3 + 4 +…. + n” n being a natural number that comes after the other as eight comes after 7, 16 comes after 15. 1027 comes after 1026. The code would look somewhat like this:</p><pre>f(n) = 1 + 2 + 3 +………+ n</pre><p>But except for going on and on, wasting your time writing code until you get to the number 127, you can write the code:</p><pre>f(n) = 1 n=1<br>f(n) = n + f(n-1) n&gt;1</pre><p>In the code, the function acts on the last number that is interpreted, so except for writing 1 + 2 + 3 + 4… you find an easier and more efficient way to write it.</p><p>A base condition stops the code from going on and forever, basically a finish line or end goal for the code. For instance, a legend with a base case or condition would look something like: (this is an example from GeekforGeeks)</p><pre>int fact(int n)<br>{<br>if (n &lt; = 1) // base case<br>return 1;<br>else<br>return n*fact(n-1);<br>}</pre><p>This return function would be your base condition, giving you an end goal of where you want to stop n such. This code seems super simple, but programmers use this tool more than you think. With such a simple task to add numbers on top of each other, it is best to know the Fibonacci sequence because it has the same idea as Recursion. The Fibonacci sequence is a type series that usually starts at 0 and 1, and you generate numbers based on the sum of the last two numbers, for instance,</p><pre>0, 1, 1, 2, 3, 5, 8, 13, 21, …</pre><h3>Fibonacci</h3><p>If we get into the Fibonacci sequence of a general idea of how recursions work, it is necessary that you also know how it works and how it solves problems. And when first learning how to use Recursion in <a href="https://visualwebz.com/python/">Python</a> or just coding in general, the Fibonacci sequence is an excellent illustration of that. A fitting example problem is the Towers of Hanoi(TOH). The <a href="https://www.geeksforgeeks.org/c-program-for-tower-of-hanoi/">Towers of Hanoi</a> or “TOH” is a mathematical puzzle where you have 3 rods and disks, like <a href="https://media.geeksforgeeks.org/wp-content/uploads/tower-of-hanoi.png">this</a>. The objective of the puzzle is to move the entire stack to another rod, but you cannot just lift all the disks at once and put them on another rod; there are rules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*QUPadVkdOW4FgTrj.gif" /><figcaption><a href="https://www.math.ucdavis.edu/~romik/tower-of-hanoi/">https://www.math.ucdavis.edu/~romik/tower-of-hanoi/</a></figcaption></figure><h4>The rules are:</h4><p>1. One disk can be moved at a time.</p><p>2. Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack; i.e., a disk can only be moved if it is the uppermost disk on a stack.</p><p>3. No disk may be placed on top of a smaller disk.</p><p>The code in Python would look something like this:</p><pre># Recursive Python function to solve tower of Hanoi<br>def TowerOfHanoi(n , from rod, to_rod, aux_rod):<br>if n == 0:<br>return<br>TowerOfHanoi(n-1, from rod, aux_rod, to_rod)<br>print(&quot;Move disk&quot;,n,&quot;from rod&quot;,from_rod,&quot;to rod&quot;,to_rod)<br>TowerOfHanoi(n-1, aux_rod, to_rod, from_rod)<br># Driver code<br>n = 4<br>TowerOfHanoi(n, &#39;A&#39;, &#39;C&#39;, &#39;B&#39;)<br># A, C, and B are the name of the rods</pre><p>Now you might have a better understanding of recursions, but you should be able to see now that there are plenty of problems when using recursions. You learned this simple idea as a child, but writing it as a code is much more complex. An informative video to illustrate this is on <a href="https://www.geeksforgeeks.org/c-program-for-tower-of-hanoi/">GeeksforGeeks.org</a>.</p><p>You see that the code might be simple and very intuitive as it is, but it can take time to grasp and understand the idea behind it genuinely. There is a great chance you run into infinite conditions because that is what most programmers run into when using recursions. For instance, let us say you are cleaning your car, and it is your first time using a different soap brand; the instructions say, “rinse, wash and repeat”. If you follow those rules, you will be washing your car forever. But thankfully, there is that one instruction that tells you to repeat those steps until necessary, which gives you that termination condition that “return” or end goal for you not to be washing forever.</p><p>If it were a robot and you forgot to add in a return function or end goal, that robot would be working forever. That is why it might seem so minor, but it’s a common mistake that programmers run into. <a href="https://realpython.com/python-recursion/#why-use-recursion">Realpython.com</a> does an excellent job of explaining how a recursion work by breaking it down into the pattern it follows:</p><ul><li>One or more base cases are directly solvable without requiring further Recursion.</li><li>Each recursive call moves the solution progressively closer to a base case.</li></ul><h3>Disadvantages</h3><p>Having an infinite function problem (Recursion Error). But there is a lot more to it. For one, the memory space it takes, a lot of memory and time is taken through recursive calls, which makes it expensive to use.</p><p>There is also something called a related run time error. When a recursive call is made, a new stack frame is created(every stack needs memory). You must correctly include a return statement terminating the code to stop to avoid running out of memory.</p><p>Even though using the recursions function helps you break down the problem and make more minor problems, you may need to catch up in the code and lose track of stacking and actions the code is causing. Also, you will run into the challenge of debugging the code. Lastly, the reasoning behind recursions can be challenging to wrap your head around, but if your calls are not terminated, you can form an infinite loop.</p><h3>When to use Recursions</h3><p>Usually, when you find yourself in a situation where you have a problem, it is too big to deal with all at once. Recursions break down your program and make your problems into “smaller problems.” For instance, problems that can be solved with Recursion include: calculating the factorial of a number, finding the nth Fibonacci number, traversing and printing the elements of a binary tree, and more.</p><h3>When you should not use Recursions</h3><p>It would be best if you did not use recursions when you can quickly solve the same problem using an iterative approach. Recursions can be slow and consume a lot of memory as they involve function calls and stack frames.</p><h3>What’s the difference between Loops and Recursions?</h3><p>You should see a lot of similarities between Recursion and <a href="https://pediaa.com/what-is-the-difference-between-recursion-and-loop/#:~:text=Recursion%20is%20a%20method%20of%20calling%20a%20function,contain%20the%20fundamental%20difference%20between%20recursion%20and%20loop.">Loops</a>; it is said that almost all recursive functions can be rewritten as loops and vice versa. A straight definition would be “recursions is a method of calling a function within the function, as for loops it’s a controlled structure that allows executing a block of code repeatedly within the program” — pediaa.com. It is commonly known that recursions are less understood because of the complex code that it has to break down into sub-problems(as you know), “a continuous loop of the problem” Georgiev says it perfectly.</p><p>A Recursion code might look like this:</p><pre>Item Search(string desired, Scope scope) {<br>for each(Item item in scope.items)<br>if(item.name == desired)<br>return item:<br>return scope.Parent? Search(desired, scope.Parent) : null;<br>}<br>Vs. code with Loops would look like this:<br>Item Search(string desired, Scope scope) {<br>for(Scope cur = scope; cur != null; cur = cur.Parent)<br>for each(Item item in cur.items)<br>if(item.name == desired)<br>return item;<br>return null;<br>}</pre><p>If you compare the two through real-life situations regarding speed and efficiency, loops have the upper hand. Recursion execution is slower, and Loops executes in a faster efficient way. Recursions also use a stacking method to store the local variables when the function is called (loops do not operate on this function). I have said this earlier in the paper, but in the case of memory and space complexity, loops beat recursions because of how much space is required for recursions. In terms of code readability, of course, this depends on the level of understanding a programmer has, but it is known that a code with recursions is more readable than a program with loops.</p><h3>Takeaway on Recursion</h3><p>There is a joke that goes on to understand. Recursion entirely means smiling at the joke that “to understand recursion, you must understand recursion.” If you know, you know, but I would like to say overall, this technique of not only being able to understand recursions fully and to be able to use this code function not only give a better and easier time as a programmer. But it will make you a better <a href="https://visualwebz.com/">programmer and coder</a> when you master this skill.</p><p>The recursive function is being used to this day, but programmers now might need to gain the critical knowledge that is behind all of it. Through all this, in the <a href="https://medium.com/@seattlewebsitedesign/starting-programming-web-development-in-2024-832104bb2f53">programming</a> world, “everyone wants to work smarter, not harder,” and if one wants to do that, one might have to consider using recursions in their code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7b91c7c0f3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sorts Algorithms]]></title>
            <link>https://seattlewebsitedevelopers.medium.com/sorts-algorithms-d8623afb445c?source=rss-eb6b2acff1ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8623afb445c</guid>
            <category><![CDATA[sorting-algorithms]]></category>
            <category><![CDATA[sort-an-array]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[sort-algorithms]]></category>
            <category><![CDATA[bubble-sort-algorithm]]></category>
            <dc:creator><![CDATA[Website Developer]]></dc:creator>
            <pubDate>Fri, 05 Jan 2024 14:24:31 GMT</pubDate>
            <atom:updated>2024-01-05T14:24:31.235Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction to Sorting Algorithms</h4><p>A sorting algorithm is any series of steps that takes an unsorted data input and returns <a href="https://visualwebz.com/structured-data-for-a-small-business-website/">data organized</a> in a specific pattern. For computer-related operations, this involves taking an input of a list or array and returning an organized list or array. Sorting primarily helps optimize data usability, as some data operations are more efficient when operating on a sorted list. This is apparent in searching, selecting, handling duplication, and analyzing data distribution. Given the usefulness of sorted data, sorting algorithms are a well-studied part of computer science. Let’s review different attributes sorting algorithms can have and present and analyze select algorithms. All algorithms will be presented in <a href="https://medium.com/@seattlewebsitedevelopers/data-science-and-python-5f60a20bd52f">Python</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zVk1oIjEE-ykNjwE" /><figcaption><a href="https://www.crazygames.com/game/sort-it-uei">https://www.crazygames.com/game/sort-it-uei</a></figcaption></figure><h4>Attributes of Sorting Algorithms</h4><p>As the number of entries N plugged into a sorting algorithm grows, so do the resources it utilizes. The primary resource usages for analyzing sorting algorithms are time and space complexity. As per the name, time complexity describes how long a sorting algorithm will take based on the magnitude of the number of operations performed. Similarly, space complexity describes how much space an algorithm needs in terms of N (the number of entries).</p><h4>Introduction to Time Complexity of Sorting Algorithms</h4><p>Evaluating sorting algorithms for time does not involve evaluating a specific runtime, as the number of entries and the resources available are unknown variables. Instead, it consists of quantifying the time the algorithms will take in terms of the number of entries. Algorithms are quantified in three different aspects: lower bound, or big Omega notation (denoted by an Omega); tightest bound, or big Theta notation (represented by a Theta); and upper bound, or big O notation (defined by O, meaning “order of”). These equate to a minimum, average, and maximum runtime. For most use cases, O, or maximum runtime, is the metric of time complexity considered. Thus, this paper will primarily consider the maximum runtime of sorting algorithms.</p><h4>Elaboration on Time Complexity of Sorting Algorithms</h4><p>The time complexity of an algorithm is quantified by how the time grows as the number of entries grows. There are several categories of time complexity in which algorithms can fit: constant time O(1), logarithmic time O(\log{n}), linear time O(n), quadratic time O(n²), and exponential time O(2^n). As these describe how an algorithm’s time increases as the number of entries increases, constant time means that the algorithm’s time is not dependent on the number of entries. This makes it the optimal runtime of a sorting algorithm, although it generally only appears as the Omega(n) runtime for pre-sorted data. However, as a general rule, the shorter the time, the better, although sometimes shorter time comes at the cost of higher space complexity.</p><h4>Space Complexity of Sorting Algorithms</h4><p>Similar to time complexity, the space complexity of a sorting algorithm is quantified by how much memory (that is, RAM or Random Access Memory) an algorithm takes to run in terms of the number of entries input. This, too, is highly dependent on the algorithm. Although it’s an important aspect to consider, generally, time complexity is weighed more heavily when considering algorithms.</p><h4>Stable Sorting</h4><p>A sorting algorithm is considered “stable” if, upon encountering equivalent values, it maintains the original order of these values when sorting. A sorting algorithm is thus considered “unstable” if it does not preserve the original order of equivalent values.</p><h4>Evaluating Specific Sorting Algorithms</h4><p>Given the attributes above of sorting algorithms, the following will evaluate common sorting algorithms for their time and space complexity.</p><h4>Insertion Sort</h4><pre># function - sorts list values from least to greatest<br>def sort_values_ascending(inputList):<br>i = 0<br>while i &lt; len(inputList):<br>ii = i<br>smallValue = inputList[ii] + 1<br>smallValueIndex = 0<br>while ii &lt; len(inputList):<br>if inputList[ii] &lt; smallValue:<br>smallValue = inputList[ii]<br>smallValueIndex = ii<br>else:<br>ii += 1<br>inputList[smallValueIndex] = inputList[i]<br>inputList[i] = smallValue<br>i += 1<br>return inputList</pre><p>This function sorts the input list from least to greatest and returns it. If inputList = [3, 2, 1, 4, 2], the function will return [1, 2, 2, 3, 4]. It accomplishes this by iterating through the sequence starting at the relative front until it finds the smallest number, then swapping the values of the smallest value and the value at the relative front of the list for each value, incrementing the location of the relative front by one for each full list read. This may be a very intuitive sort, but when analyzed for time complexity, it comes up somewhat short at O(n²) time complexity. The space complexity of insertion sort is only the array itself, as shown in the example above, and as mentioned by <a href="https://www.codingninjas.com/codestudio/library/time-and-space-complexities-of-sorting-algorithms-explained">Coding Ninjas</a>, as it updates the original array itself while iterating. However, its inability to scale well with the number of entries input makes it an unrealistic pick when dealing with an arbitrarily large number.</p><h4>Bubble Sort</h4><pre>def bubble_sort(alist):<br>for i in range(len(alist) - 1, 0, -1):<br>no_swap = True<br>for j in range(0, i):<br>if alist[j + 1] &lt; alist[j]:<br>alist[j], alist[j + 1] = alist[j + 1], alist[j]<br>no_swap = False<br>if no_swap:<br>return<br>alist = input(&#39;Enter the list of numbers: &#39;).split()<br>alist = [int(x) for x in alist]<br>bubble_sort(alist)<br>print(&#39;Sorted list: &#39;, end=&#39;&#39;)<br>print(alist)</pre><p>As written above by Manish Bhojasia, bubble sort has a time complexity of O(n^n), which is worse than insertion sort. However, its best time complexity is linear, and the time complexity scales directly with how unsorted a list is, making it a highly situational sorting algorithm. The bubble sort sorting algorithm only has a space complexity of O(1), or a constant space complexity, as it swaps the values of the original dataset.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FKLvH6yi5YYU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DKLvH6yi5YYU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FKLvH6yi5YYU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4889f9e0af71d1e0b4e5a23c0e3f8a31/href">https://medium.com/media/4889f9e0af71d1e0b4e5a23c0e3f8a31/href</a></iframe><h4>Merge Sort</h4><pre># Python program for implementation of MergeSort<br># Merges two subarrays of arr[].<br># First subarray is arr[l..m]<br># Second subarray is arr[m+1..r]<br>def merge(arr, l, m, r):<br>n1 = m - l + 1<br>n2 = r - m<br># create temp arrays<br>L = [0] * (n1)<br>R = [0] * (n2)<br># Copy data to temp arrays L[] and R[]<br>for i in range(0, n1):<br>L[i] = arr[l + i]<br>for j in range(0, n2):<br>R[j] = arr[m + 1 + j]<br># Merge the temp arrays back into arr[l..r]<br>i = 0 # Initial index of first subarray<br>j = 0 # Initial index of second subarray<br>k = l # Initial index of merged subarray<br>while i &lt; n1 and j &lt; n2:<br>if L[i] &lt;= R[j]:<br>arr[k] = L[i]<br>i += 1<br>else:<br>arr[k] = R[j]<br>j += 1<br>k += 1<br># Copy the remaining elements of L[], if there<br># are any<br>while i &lt; n1:<br>arr[k] = L[i]<br>i += 1<br>k += 1<br># Copy the remaining elements of R[], if there<br># are any<br>while j &lt; n2:<br>arr[k] = R[j]<br>j += 1<br>k += 1<br># l is for left index and r is right index of the<br># sub-array of arr to be sorted<br>def mergeSort(arr, l, r):<br>if l &lt; r:<br># Same as (l+r)//2, but avoids overflow for<br># large l and h<br>m = l+(r-l)//2<br># Sort first and second halves<br>mergeSort(arr, l, m)<br>mergeSort(arr, m+1, r)<br>merge(arr, l, m, r)<br># Driver code to test above<br>arr = [12, 11, 13, 5, 6, 7]<br>n = len(arr)<br>print(&quot;Given array is&quot;)<br>for i in range(n):<br>print(&quot;%d&quot; % arr[i],end=&quot; &quot;)<br>mergeSort(arr, 0, n-1)<br>print(&quot;\n\nSorted array is&quot;)<br>for i in range(n):<br>print(&quot;%d&quot; % arr[i],end=&quot; &quot;)<br># This code is contributed by Mohit Kumra</pre><p>As written here by Mohit Kumra, Merge sort is one of the more versatile sorting algorithms. It takes a divide-and-conquer approach to sort, dividing the dataset into halves until it can no longer do so. It has a time complexity of O(n log n), which, as mentioned by <a href="https://www.codingninjas.com/codestudio/library/time-and-space-complexities-of-sorting-algorithms-explained">Coding Ninjas</a>, is equivalent to the best, worst, and average case scenario. It has a space complexity of O(n), which is minimal when considering the relatively.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FcVZMah9kEjI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcVZMah9kEjI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcVZMah9kEjI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/33d233e4dd584f66d4a8b49e1e2131b2/href">https://medium.com/media/33d233e4dd584f66d4a8b49e1e2131b2/href</a></iframe><h4>Quick Sort</h4><pre># Python program for implementation of Quicksort Sort<br># This implementation utilizes pivot as the last element in the nums list<br># It has a pointer to keep track of the elements smaller than the pivot<br># At the very end of partition() function, the pointer is swapped with the pivot<br># to come up with a &quot;sorted&quot; nums relative to the pivot<br># Function to find the partition position<br>def partition(array, low, high):<br># choose the rightmost element as pivot<br>pivot = array[high]<br># pointer for greater element<br>i = low - 1<br># traverse through all elements<br># compare each element with pivot<br>for j in range(low, high):<br>if array[j] &lt;= pivot:<br># If element smaller than pivot is found<br># swap it with the greater element pointed by i<br>i = i + 1<br># Swapping element at i with element at j<br>(array[i], array[j]) = (array[j], array[i])<br># Swap the pivot element with the greater element specified by i<br>(array[i + 1], array[high]) = (array[high], array[i + 1])<br># Return the position from where partition is done<br>return i + 1<br># function to perform quicksort<br>def quickSort(array, low, high):<br>if low &lt; high:<br># Find pivot element such that<br># element smaller than pivot are on the left<br># element greater than pivot are on the right<br>pi = partition(array, low, high)<br># Recursive call on the left of pivot<br>quickSort(array, low, pi - 1)<br># Recursive call on the right of pivot<br>quickSort(array, pi + 1, high)<br>data = [1, 7, 4, 1, 10, 9, -2]<br>print(&quot;Unsorted Array&quot;)<br>print(data)<br>size = len(data)<br>quickSort(data, 0, size - 1)<br>print(&#39;Sorted Array in Ascending Order:&#39;)<br>print(data)</pre><p>As presented here by <a href="https://www.geeksforgeeks.org/python-program-for-quicksort/">Geeks for Geeks</a>, quick sort is another search algorithm with the divide and conquer method. It has a time complexity of O(log n) and a space complexity of O(n), making it similar to the Merge sort, with different use cases.</p><h4>Which Algorithm?</h4><p>A sorting algorithm only becomes essential when dealing with large amounts of data. As such, the built-in function should suffice for trivial purposes. However, when dealing with large amounts of data, one should consider how significant the time and space complexity is to them, based on their use case and resources available, and pick an algorithm appropriate to their use case.</p><h4>Common Errors</h4><p>A <a href="https://medium.com/@seattlewebsitedevelopers/common-python-programming-errors-1364d3230025">common error</a> when making a sorting algorithm could be not checking whether or not it’s already been made, as sorting algorithms are a relatively well-studied topic. When programming a sorting algorithm, a possible error is not correctly incrementing one’s loop, thus creating an infinite loop. When <em>using</em> a sorting algorithm, an easy mistake would be picking one that is not well suited to one’s use case, i.e., just using the default sorting algorithm when another one is more appropriate. However, unless dealing with large amounts of data, the difference can be small enough that it doesn’t matter much — it entirely depends on the use case.</p><h4>Takeaway</h4><p>Sorting algorithms can be beneficial for making data more usable. Sorted data improves search efficiency, data selection, duplication handling, and data distribution analysis. This is especially relevant today, given the massive amounts of data produced. Many searching algorithms are available, and picking one that fits the job is essential when dealing with large amounts of data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8623afb445c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BeanShell Language]]></title>
            <link>https://seattlewebsitedevelopers.medium.com/beanshell-language-d88122669150?source=rss-eb6b2acff1ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/d88122669150</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[beanshell-overview]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[beanshell]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Website Developer]]></dc:creator>
            <pubDate>Fri, 05 Jan 2024 14:14:53 GMT</pubDate>
            <atom:updated>2024-01-05T14:14:53.630Z</atom:updated>
            <content:encoded><![CDATA[<p>Researching <a href="https://beanshell.github.io/">BeanShell</a> has proven to be worth my time. It is a handy Java source interpreter. BeanShell is very versatile in Java regarding what it can be used for and its Benefits. BeanShell has been around for almost as long as Java has, growing and helping code ever since.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/0*jpf0cEn4PZiVGqhb.png" /><figcaption><a href="https://beanshell.github.io/">https://beanshell.github.io/</a></figcaption></figure><h3>What is BeanShell?</h3><p>BeanShell is a lightweight, embeddable Java source interpreter that includes features in object scripting. BeanShell is written in the Java Language. BeanShell is exceptional in the way it can execute standard Java syntax. It can extend the syntaxes with popular scripting techniques that include loose types, commands, and method closures like those found in Perl and JavaScript.</p><h3>BeanShell History</h3><p>During 1993, Patrick Niemeyer was heavily interested in the Tcl/Tk scripting. He was working at Southwestern Bell Technology Resources at the time. With the advice of a friend, Patrick picked up a coding language called Oak, which would later become Java. Patrick unknowingly became one of the first book writers for the language that went mainstream. The book was called “Exploring Java, O’Reilly &amp; Associates.” Patrick also created Java’s first scripting language, BeanShell.</p><p>BeanShell was not ready to be released to the public until 1997. It didn’t do anything special before Java’s 1.1 updates, where it had helped create updates for Patrick’s book. Because BeanShell started to help code in Java, Patrick decided to “Polish it up and release it.”</p><h3>Who Uses BeanShell and Trends of BeanShell’s Popularity.</h3><p>Since its release, BeanShell has slowly accumulated more popularity. Though BeanShell has had its ups and downs in trending popularity, it has leveled out in growth. BeanShell is bundled in a bunch of programming software nowadays, so much so that it might be hard to find a Java scripting language that doesn’t include some aspect of BeanShell. Some notable bundles with BeanShell integrated into their product include Emacs as part of their JDE, NetBeans for Sun Microsystems, Forte for Java IDEs, and BEA’s WebLogic application server. With the logic of BeanShell being bundled in all these programs, it makes sense that BeanShell has found its home in many places. The most significant discrepancy between the people who use BeanShell recorded is very wild. Scientists from CERN in their super techy laboratories are recorded to have used BeanShell in their software. While at the other end of the spectrum, BeanShell is being used to teach nine-year-olds how to code. Another significant discrepancy includes BeanShell being integrated into “Large financial applications.” While on the other end of the spectrum, BeanShell can be embedded into remote floating Buoys.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FRBsWEENzSQ8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DRBsWEENzSQ8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FRBsWEENzSQ8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ffacbe18f9c3b608a63af16e7a263a93/href">https://medium.com/media/ffacbe18f9c3b608a63af16e7a263a93/href</a></iframe><h3>Examples of Code</h3><h4>Loop:</h4><p>BeanShell can support Java 1.5 for-loops for anything that covers arrays and collections. Even though BeanShell is not limited to Java 1.5</p><pre>List foo = aRandomList();<br>for ( someElement : foo )<br>print( someElement );<br>for ( Object anotherElement: foo )<br>print( anotherElement );<br>int [] array = new int [] { 1, 2, 3 };<br>for( i : array )<br>print(i);<br>for( char c : &quot;some string&quot; )<br>print( c );</pre><h4>If-statement:</h4><p>All the regular Java statements will work for BeanShell. BeanShell only really builds upon Java and improves the quality of life features. Even so, here is an example of a very simple if statement.</p><pre>if ( something happening ) {<br>int x = 1;<br>y = x*5;<br>print(y)<br>}</pre><p>For all variables, they are assigned a type. Like for instance, “JButton.” BeanShell can support these types, as is the norm in other programming languages like Java. For these types of assigned-type variables, assigning a different type to those variables will always result in an error message. This kind of situation is best suited for Bean Shell. One of BeanShell’s most prominent features is the ability to assign variables without declaring them first or assigning any type. This process would also classify these variables as dynamic. BeanShell will check those variables when the code is run at that time. Here are some examples where Java syntax is typed loosely.</p><pre>// Loosely Typed Java syntax. <br>// Use a hashtable<br>hashtable = new Hashtable();<br>date = new Date();<br>hashtable.put( &quot;today&quot;, date );<br>// Print the current clock value<br>print( System.currentTimeMillis() );<br>// Loop<br>for (i=0; i&lt;5; i++)<br>print(i);<br>// Pop up a frame with a button in it<br>button = new JButton( &quot;My Button&quot; );<br>frame = new JFrame( &quot;My Frame&quot; );<br>frame.getContentPane().add( button, &quot;Center&quot; );<br>frame.pack();<br>frame.setVisible(true);</pre><p>Looking directly at the code from a glance, the difference between traditionally assigned and loosely typed Java syntax doesn’t seem like much. But it is amazing. The technique proves helpful when scripting is part of the <a href="https://visualwebz.com/website-testing/">development and testing process</a>. It is beneficial when the software is interactable.</p><p>A “loose” variable can be assigned to a type, and then its type can be overwritten to another later. The opposite can also be true. There can be no variable, but BeanShell can hold the Java Primitive values like int and Boolean. BeanShell is also brilliant when it comes to assigning those primitive values. It knows the real types and will only allow the appropriate use of those values. This includes doing the correct “numeric promotion” akin to what Java usually does when used in an expression.</p><h3>What is BeanShell used for?</h3><p>BeanShell can interactively test Java code, find bugs in code, and find ways to improve upon the code through <a href="https://visualwebz.com/website-resources/app-development/1.test-on-mobile-device.pdf">testing</a>. Scripting Java allows it to be used in many applications.</p><p><strong>Those applications include:</strong></p><ul><li>Rapid Prototyping is a group of techniques that makes it easier to create a scale model of something — frequently done to create three-dimensional computer-aided design data (<a href="https://en.wikipedia.org/wiki/Computer-aided_design">CAD</a>). The data is then used to make 3D visual renders or printed with a 3D printer.</li><li>User Scripting Extension is a program frequently written in JavaScript for modifying web pages to customize the browsing experience. A user script manager browser extension like <a href="https://en.wikipedia.org/wiki/Greasemonkey">Greasemonkey</a> is standard to run smoothly on the Firefox internet browser.</li><li>Rule Engines is a program that surveys data provided and then executes actions corresponding to the conditions matched in the provided data. Rule engines are used for many reasons. One reason is that its code is straightforward to read, even for people unfamiliar with coding. Another reason is that all rules are in one place for easy organization. Code maintenance is easy since rules can easily be updated.</li><li>Testing BeanShell is easily testable with its debug() command. Allowing for easy revisions in code.</li><li>Dynamic Deployment: BeanShell can deploy, redeploy, and un-deploy an application or module without restarting the server. This is very useful for developers since they can bring an application or module to life without wasting time restarting the server for the app or module. Whenever a redeployment usually happens, it breaks every session — forcing every client to restart their session.</li><li>Embedded systems are a godsend of a feature. Embed BeanShell into systems makes it very flexible in what kind of code can be included. BeanShell can upgrade the system to be <a href="http://www.beanshell.org/manual/embeddedmode.html">highly customizable</a> without all the hardships of compiling Java classes and knowing Java syntax.</li><li><a href="http://www.beanshell.org/manual/bshmanual.html">Java education</a>, BeanShell is very versatile, so much so that the difference between the super technical and the most simple <a href="https://seattlewebsitedeveloper.com/">developers</a> ranges from high-energy physics laboratories at CERN to programming classrooms for nine-year-olds.</li></ul><h3>How does BeanShell work exactly?</h3><p>BeanShell is very lightweight and embeddable. This means BeanShell can be called into Java applications to execute code dynamically. It can also be running at run-time or provide extensibility to the application. BeanShell can also manipulate Java applications. Allowing for work with Java objects and application programming interfaces dynamically. Thanks to BeanShell being written in Java and running in the same Virtual Machine as an application, references to live objects can freely pass into scripts and return them as results. BeanShell is a combination of dynamically interpreted Java, a scripting language, and a flexible environment. All in one.</p><h3>What are some benefits of BeanShell?</h3><p>The most significant benefits of BeanShell are as follows:</p><ul><li>BeanShell can execute the entirety of Java syntax dynamically. It can also run Java code written as only fragments. Even loosely typed Java is different from BeanShell. BeanShell has more convenient benefits, but these are the most prominent.</li><li>Full transparent access to all Java objects as well as application programming interfaces.</li><li>BeanShell can be run in four modes:</li><li>Command Line</li><li>Console</li><li>Applet</li><li>Remote Session Server</li><li>Works well with secure environments. Does not need a class loader or bytecode generation for the most part.</li><li>The BeanShell interpreter is a tiny file. BeanShell is around one hundred fifty kilobytes as a jar file.</li><li>BeanShell is 100% Java and nothing else.</li><li>BeanShell is 100% <a href="http://www.beanshell.org/license.html">Free!!</a></li><li><a href="http://www.beanshell.org/intro.html">Java Evaluation Benefits</a></li><li>BeanShell can dynamically evaluate entire Java source classes and isolate Java methods, statements, and expressions.</li><li><a href="http://www.beanshell.org/intro.html">Scripting Benefits</a></li><li>Variables can be typed optionally.</li><li>Scripted methods can have optionally typed arguments and can also return values.</li><li>Scripted objects using method closures.</li><li>Scripted interfaces that can also include event handlers.</li><li>Convenience syntax for handling Properties, hash tables, and primitive wrapper types in JavaBean.</li><li>Variables can be auto-allocated to emulate Java property files.</li><li>An extensible set of utility and shell-like commands</li><li>Dynamic classpath management useful for fine-grained class reloading</li><li>Dynamic command loading along with user command path</li><li>Sophisticated namespace and call stack management</li><li>Detailed error reporting</li></ul><p>BeanShell is one crazy helpful Java source interpreter. It is almost a necessity when coding with Java. A Java coder made beanShell for coding with Java. It has been around since the beginning! (although not released to the public until later) Many benefits and quality-of-life changes come with working with BeanShell that only a fool wouldn’t use!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d88122669150" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are Computer files?]]></title>
            <link>https://seattlewebsitedevelopers.medium.com/what-are-computer-files-c8eb72e4465c?source=rss-eb6b2acff1ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8eb72e4465c</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[folders]]></category>
            <category><![CDATA[filesystem]]></category>
            <category><![CDATA[computer-file]]></category>
            <dc:creator><![CDATA[Website Developer]]></dc:creator>
            <pubDate>Fri, 05 Jan 2024 14:01:30 GMT</pubDate>
            <atom:updated>2024-01-05T14:01:30.252Z</atom:updated>
            <content:encoded><![CDATA[<p>Files are <a href="https://www.techopedia.com/definition/7199/file">storage containers for computers</a>. They can be used for recording, storing, and reading data. It can be considered writing on paper; the computer is the paper, and the files are the writing. There are many different types of files with different kinds of purposes. There can be text, video, images, and many others. All these files are categorized separately on the computer’s storage system, usually by the extension, i.e., photo files are typically a .jpeg or .png, text files are generally .txt or .docx, and the list goes on for many other file types. Simply put, files store different kinds of information on computers. On a side note, many companies have custom file extensions specified for their <a href="https://en.wikipedia.org/wiki/List_of_file_formats">custom file extensions</a> specified for their <a href="https://visualwebz.com/web-development-software/">product or software.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*kfAtswdueZK4BHb8.png" /><figcaption><a href="https://www.networxsecurity.org/members-area/glossary/c/computer-file.html">https://www.networxsecurity.org/members-area/glossary/c/computer-file.html</a></figcaption></figure><h4>What are files used for in Python?</h4><p>Python files are similar to other files in that they are used for reading, writing, and accessing storage. Python files are a specific type of file with Python code that can be opened with Python interpreters like VCS, PyCharm, and many others. There’s also a use for other files inside Python files. Many functions inside Python interact with different types of files. <a href="https://www.w3schools.com/python/python_file_handling.asp">Files can be referenced, edited, deleted, etc., inside Python.</a> This gives the user creative freedom to write programs and many other programs with different purposes. A few examples would be a program that mass deletes files off your computer. This would be helpful if, for example, your computer had a lot of junk files on it, and you wanted to clean it in bulk. Writing a program that mass deletes certain files could be possible. Another example would be a program that can write new content into files. If you, for example, wanted to edit many files in bulk, you could write a Python program that would do just that. Many functions in Python take advantage of the ability to modify files on your computer.</p><h4>How are they used in Python?</h4><p>Here’s an example of <a href="https://www.w3schools.com/python/python_file_open.asp">opening files in Python:</a></p><p>Code:</p><pre>A = open(&quot;sample.txt&quot;, r)<br>Print(A.read())</pre><p>Whatever “sample.txt” had inside of it.</p><h4>Explanation:</h4><p>The first string defines the variable A to open the file called “sample.txt”. This creates a reference point for Python to call back to. The “r” at the end of the line stands for “read’, which means Python will read the contents of the file. The second string is telling Python to output text from the variable “A”, which we defined to be “sample.txt” earlier. This means that printing the variable “A” will print out the contents of “sample.txt”.</p><p>This function would be massively helpful in a big project, where much of the information is stored in separate files. With Python, people can quickly call back to other files to display the stored data.</p><p>Here’s an example of<a href="https://www.w3schools.com/python/python_file_write.asp"> adding content to an existing file in Python:</a></p><p>Code:</p><pre>A = open(&quot;sample.txt&quot;, &quot;a&quot;)<br>A.write(&quot;Sample content&quot;)<br>A.close</pre><p>The output would modify the file by adding the content inside the quotes to the end of the original file.</p><h4>Explanation:</h4><p>The first line defines the variable “A” to open the file called “sample.txt”. This also creates a reference point for Python to open the file. The “a” at the end of the line stands for “append”, meaning new content will be added to the end of the file. The following line references the original file with “A.write”, and the .write at the end specifies that the file will have new content written inside of it. The text inside the quotes would be added to the end of the file. The last line closes the reference.</p><p>This program would also be beneficial in a big project if new data needs to be added to existing files. An earlier expression could collect information from the user and have that information written into a file. The file could be edited multiple times throughout the program and store many user inputs.</p><p>Here is a video detailing some other ways to handle files in Python.</p><h4>-Advanced Uses</h4><p>There are some more advanced uses for files within Python. These uses are harder to implement but come with many benefits. These functions are much more diverse and customizable in their uses. One advanced use would be to <a href="https://www.digitalocean.com/community/tutorials/python-read-file-open-write-delete-copy">output the contents of the file line by line.</a> This function could display large amounts of info and even modify how the information is structured / how it looks.</p><p>Code:</p><pre>File = open(&quot;sample.txt&quot;, &quot;r&quot;)<br>List = file.readlines();<br>For line in list<br>Print(list)<br>File.close()</pre><p>This program would output the contents of the file line by line. However, modifying the print command can change the output to look different.</p><h4>Explanation:</h4><p>The first line defines the variable “File” to open the sample text file with information inside it. The second line represents the variable “List” to the “readlines” command. This command reads the information in the sample file. The following line uses a for-loop. <a href="https://www.w3schools.com/python/python_for_loops.asp">A for-loop</a> repeats a command or function for every line. The for-loop causes Python to print out the information line for line. The last line will close the file.</p><p>This program is also useful when a lot of information needs to be displayed. This program is very similar to the previous one. The print functionality lets the user modify the output’s appearance when the command is run. Some example customizations could be adding specific phrases to the beginning or end of the printed lines. Another one could be numbering the lines. This program could be modified and integrated into a big project.</p><p>Another example of a more advanced <a href="https://www.techiedelight.com/delete-all-files-directory-python/">function would be to mass delete files</a>. A good use for this would be to clear out a large folder inside your computer without manually doing it. Clearing out files manually off your computer at a certain point becomes tedious, and Python allows you to automate the process and save time.</p><p>Code:</p><pre>Import os<br>Path = r&quot;C:\Parent\folder\SampleFolder\\&quot;<br>For file_name in os.listdir(path):<br>File = path + file_name<br>If os.path.isfile(file)<br>Print(&#39;Deleting file:&#39;, file)<br>Os.remove(file)</pre><p>This program would remove the files inside the specified folder. The output would show a list of files being deleted as it continues going through the folder.</p><h4>Explanation:</h4><p>This function requires the user to import a <a href="https://docs.python.org/3/tutorial/modules.html">custom module</a>. Modules are extensions of Python made by people who can extend and change how Python works. The “os” module allows users to manipulate their operating system with commands. The first line of the program declares the module for Python to interpret. The second line defines the variable “Path” to the specific file path the user wishes to delete. The third line establishes a for-loop to sift through every file in the directory that the user specified earlier. The fourth line combines the file path with the file name, determining what the program needs to look for. The fifth line uses an <a href="https://www.w3schools.com/python/python_conditions.asp">if-statement</a> and tells Python to delete the file using the “os.remove” command.</p><p>This is the most advanced program that I’ve written about. As I’ve written earlier, this program would be beneficial if a user needed to delete folders with many files inside. Once a folder is filled with enough files, clearing them out manually becomes tedious and time-consuming. This program will automate the process and save you a lot of time. This can be taken further by automatically clearing folders repeatedly after a specific time. For example, you can set this program to clear out your temp folder once every month. The temp folder on your computer stores temporary information from your browser, software, etc., and fills up very quickly. Deleting the contents of the temp folder will free up space and possibly even make your computer run smoother.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FbqNvkAfTvIc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbqNvkAfTvIc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FbqNvkAfTvIc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/04c6640fdad4dda041335ca05d32cc49/href">https://medium.com/media/04c6640fdad4dda041335ca05d32cc49/href</a></iframe><h4>Common Problems</h4><p>There are common problems when working with Python. Specifically, with files, there are common mistakes that users can make. One common one would be clashing file names. When files have clashing names, it could cause Python to struggle with determining which one to operate on. Some ways to fix this would be to specify the file type within the program and possibly change the name of the file that the user would want to operate on. This only applies when the file names are the same.</p><p>Another common problem could be not closing the file after it’s been modified within the code. Closing the file is required at the end of the operation because it could interfere with the other functions. For example, if you want to read, append another one immediately. You’d have to close the file at the end of both operations because they might interfere with each other and cause errors. A fix for this would be to close the files after you have finished your operations.</p><p>The last common mistake I’ll write about is the file not found or “FileNotFoundError” that may pop up when working with files in Python. This error pops up when Python can’t identify or locate the file you directed. The fix for this is to ensure you have specified the correct file path for Python to look for. Sometimes, you may need to select the entire file path, starting with the drive’s name, the user, etc.</p><p>The other common errors the user may encounter are common Python errors. Things like syntax and logic errors. Syntax errors are usually misspelling errors, where an argument or command is misspelled, causing the program to stop working. These are generally fixed by proofreading the file and ensuring everything is spelled correctly. Logic errors are where the files don’t have errors, but the program outputs a response it shouldn’t. These happen when people mistype the function to do something other than what the user wants. For example, if someone wrote two minus two instead of two plus two. The output would be zero, even though the user would expect a result of four. Similarly to the last one, this error is usually fixed by proofreading the file.</p><h4>Takeaway</h4><p>Files are used to store information on computers. Many kinds of files hold different types of information. Files containing text, audio, images, videos, etc., are constantly used by your computer to display the information inside. These files store and modify data in almost every task computers perform. In <a href="https://visualwebz.com/python/">Python</a>, files also store information, typically some code or program that can be executed. Python also can modify, create, or change files within the code. This allows the user to automate tasks efficiently. Using these functions to automate simple tasks can save precious time writing code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8eb72e4465c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Science and Python]]></title>
            <link>https://seattlewebsitedevelopers.medium.com/data-science-and-python-5f60a20bd52f?source=rss-eb6b2acff1ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f60a20bd52f</guid>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[programmers-life]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[data-science-and-python]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Website Developer]]></dc:creator>
            <pubDate>Tue, 21 Mar 2023 15:39:42 GMT</pubDate>
            <atom:updated>2023-03-21T15:39:42.043Z</atom:updated>
            <content:encoded><![CDATA[<p>People of the world today have access to various types of technological resources and media. Examples include the internet, the web, and mobile devices. As the internet and the web emerged from being a digital display of information to becoming a medium for shared interactions of numerous users and for the expansion of online companies, the amount of data increased. Similarly, with the technological advancement of mobile devices, <a href="https://www.bigdataframework.org/short-history-of-big-data/">“it is possible to track movement, analyze physical behavior and even health-related data (number of steps you take per day),”</a> These advances in the world of technology have resulted in continuous growth in the production of data available, opening a new world of possibilities in extracting useful information and knowledge using data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*LF0AOlRr0oO_j0WY.png" /><figcaption><a href="https://medium.com/edureka/learn-python-for-data-science-1f9f407943d3">https://medium.com/edureka/learn-python-for-data-science-1f9f407943d3</a></figcaption></figure><p>Due to this new rise of data, difficulties arise in handling and using the large volumes of data available today. Introducing the technical field of data science supports solving these new masses of data problems. From these solutions, data science helps organizations use the data to derive useful information and insights. ­­</p><h4>What is Data Science?</h4><p>Data science is the study and analysis of data. It involves using different tools and techniques to interpret and derive meaningful information, knowledge, and patterns within a large amount of data to build an understanding to <a href="https://www.dataversity.net/brief-history-data-science/">make efficient decisions</a>. The need for data science came about due to the massive production of data that forms each second of the day. Difficulties arise in handling the vast volumes of data that increase each day. Data science offers powerful, complex algorithms and technologies to solve the challenge of handling and evaluating this data. It involves the combination of mathematical, computational, and statistical disciplines.</p><p>In the modern world, data science has heavily grown involvement in businesses and organizations, solving company problems using knowledge from data. Data insights allow businesses to make effective decisions that will lead to the desired outcome for a business. An example of data-driven decision-making used in industries is customer prediction decisions in product marketing. By analyzing a system of data that includes information on customer behavior patterns, marketers can use this to predict customer desires, needs, future behaviors, and the overall likelihood of buying a product.</p><p>Data science is <a href="https://community.nasscom.in/communities/data-science-ai-community/know-primary-goal-and-importance-data-science#:~:text=The%20ultimate%20goal%20of%20data,for%20a%20better%20customer%20experience.">significant in the growth of businesses</a> by modifying new strategies and operations for an increase in customer satisfaction with the use of the decisions and insights offered by data analysis.</p><h4>Data Science Life Cycle</h4><p>The process of data science in business project scenarios consists of a cycle of several steps. This cycle may vary for different companies but follows a similar process overall. Each step in the process is divided into different roles and responsibilities. The parts involved in the building and development of the project are business analyst, data analyst, data scientist, data engineer, data architect, and machine learning engineer. The following are the steps involved in the cycle of data projects:</p><ul><li>1. Developing a <a href="https://www.analyticsvidhya.com/blog/2021/05/introduction-to-data-science-project-lifecycle/">business understanding</a> of the problem the client is facing and what is needed to be achieved. This is the role of the business analyst. They are responsible for asking the required questions to gather details from the client, understand what is happening in the client’s business, and define the problem.</li><li>2. After recognizing the problem, the data collection process is done by the data analyst team. This step involves finding and reviewing all the various data sources (internal and external) available that address the problem that is being solved. Sources may include web server logs, social media posts, US Census datasets, etc. It is overall the process of gathering the data. To do this, data analysts need to have a proper way to source the data. The two tracks they source the data are web scraping and extracting data from third-party APIs.</li><li>3. Next is <a href="https://www.analyticsvidhya.com/blog/2021/05/introduction-to-data-science-project-lifecycle/">data preparation</a>. This step is one of the most critical steps of the cycle that takes the most time compared to the others. It is the process referred to as data cleaning. It is formatting the data in sufficient structure and removing unnecessary functions. Data must be well organized and easy to understand to prepare for analysis. When data is found, it may not be in the best and most accurate format. It may need values, duplicate data, or incorrect data. With data cleaning, steps are made to identify and fix incorrect data.</li><li>4. <a href="https://www.analyticsvidhya.com/blog/2021/05/introduction-to-data-science-project-lifecycle/">Data modeling</a>. It is the process of taking the prepared data and selecting a proper machine learning algorithm where the data set is formed into a model and visual representation. With the use of these tools, this is where the analysis of the data comes to play. The step gives the tools to understand the data better, bringing in insights, predictions, and outcomes from the data.</li></ul><p>Programming plays a vital role in each data analysis project step. It plays a role in the stages of data collecting, data preparation, and data modeling. It is only easy to perform these tasks with the involvement and supporting tools of programming. In data collection, web scraping, the extraction of data from the web, is a process that lines of code can do. This is also the case for data cleaning and machine learning tasks. With various programming tools, the several functions in the life cycle of data science can and support be completed more efficiently. Over the past several years, <a href="https://visualwebz.com/python/">Python</a> has been the most used programming language for data analysis.</p><h3>What is Python?</h3><p>Python is an object-oriented, open-sourced, high-level programming language used for <a href="https://seattlewebsitedeveloper.com/">general-purpose programming</a>. Python is mainly known for its simplicity; it has a cleaner and more readable syntax than other programming languages. Despite the simplicity of this programming language, Python is also powerful enough to handle complex applications. Because it is an object-oriented language, Python organizes code into objects that can interact and communicate with each other. Python can operate and be used in many ways. <a href="https://visualwebz.com/">Web development</a>, data analysis, artificial intelligence, and many more. Python is known for its increased productivity because there is no compilation step, and the edit-test-debug cycle is fast. Debugging Python programs is easy; a wrong input will raise an exception.</p><h4>Why Python?</h4><p>The factors considered before deciding which language is the best for data analysis are speed, availability of packages, and design goal. By using Python, one has access to a significant number of packages. Python’s simplicity and easy-to-understand syntax rules help build applications with a concise, readable codebase. A few lines of code can achieve many tasks to achieve design goals. Considering these factors using Python can lead to faster data project completion.</p><p>Python is a popular language used often in data science for this ease of understanding and accessibility to various libraries that include functions of prewritten chunks of code that programmers can reutilize and optimize a task. The extensive range of libraries and tools makes it easy and efficient for data scientists to work with large datasets, manipulate data, and visualize results.</p><h4>Python Libraries for Data Analysis</h4><p>Data scientists use Python’s NumPy and Pandas libraries, commonly used for data manipulation tasks. They use Python’s Matplatlib and Seaborn libraries for data visualization. These are the few libraries that data scientists use provided by Python that make their work easier.</p><p>Data scientists use Python’s <a href="https://jakevdp.github.io/PythonDataScienceHandbook/02.00-introduction-to-numpy.html">NumPy</a> because it can support multi-dimensional arrays. The arrays in the NumPy library are enhanced for numerical operations, making them operate much faster and more efficiently when working with larger data sets. The library also is popular for machine learning applications, as it makes machine learning algorithms much more efficient and straightforward. NumPy is also designed to be compatible with other Python libraries.</p><p>Data scientists also use a Python library named Panda. Panda is used because of its robust data manipulation, analysis, and modeling tools. This library makes it easy to clean and preprocess data and transform data into different formats. It also has tools that help data scientists explore data and spot patterns. These tools help with exploring data, visualization, and filtering. Panda also has a flexible data manipulation API. Which makes it easier to slice, index, and filter data. Having this flexible API, manipulating data sets, and performing advanced operations is easy.</p><p>Another library scientists use is Matplotlib, commonly used for data visualization. This library has a set of tools that can create high-quality visualizations of data. They use this library to create visualizations to help spot patterns and trends when exploring data. Not only does this library analyze data, but they also use it to make a visualization to present data they are trying to share with others. These visualizations include line charts and bar charts.</p><p><a href="https://towardsdatascience.com/best-seaborn-visualizations-for-data-science-3d866f99c3a9">Seaborn</a><strong> </strong>is another Python library that data scientists use for visualization. The Seaborn library has a high-level interface for creating informative visualizations. This library has a more charming visualization style, making the charts and graphs quickly look good without customizing them. Seaborn has a variety of visualizations that can be used for data exploration. Like Matplotlib, Seaborn uses line charts and bar charts for visualization. Seaborn tools help with regression analysis and hypothesis testing. The library also uses the Jupyter Notebook environment to allow data scientists to explore data in real time and create interactive dashboards for presenting data.</p><h3>Takeaway</h3><p>As our world is continuously filled with numerous databases, data science’s primary goal is to help handle this available data, analyze it, and visualize it to solve problems and make insightful decisions and predictions. For this to happen, data scientists need efficient tools to deal with these large datasets. Python is a crucial tool that supports data science to accomplish its goal. Because of the vast number of available libraries and packages, data science programmers can access many tools in their toolboxes. When working on projects, Python helps make the job easier and become more effective. This allows data scientists to save time to focus on the main problem. With the collaboration of the computing power of Python and data analysts, we can form solutions to several data-related issues and improve decision-making.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f60a20bd52f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common Programming errors]]></title>
            <link>https://seattlewebsitedevelopers.medium.com/common-programming-errors-784f2bb37a97?source=rss-eb6b2acff1ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/784f2bb37a97</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[developer-stories]]></category>
            <category><![CDATA[programming-issue]]></category>
            <category><![CDATA[errors-and-omissions]]></category>
            <category><![CDATA[common-programming-errors]]></category>
            <dc:creator><![CDATA[Website Developer]]></dc:creator>
            <pubDate>Sun, 12 Feb 2023 13:36:04 GMT</pubDate>
            <atom:updated>2024-04-05T16:39:58.340Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Introduction</h3><p>The greatest enemy in programming to all programmers is getting errors, and everyone has experienced getting errors when they run the code. Even the well-experienced programmer is still facing an error. Programming is a tricky and delicate thing to do when you need to be more careful.</p><p>Why are we getting an error? Well, humans and computers speak in different languages, and we humans are practicing these various types of computing languages to command these machines to do work for us. So, there might be some misunderstanding when we are controlling them, like computers don’t understand what we are trying to do because we didn’t use the correct block of code or didn’t specify what to output.</p><p>Coding errors could be typos, flawed logic, or accidental oversight; even those little ones can manifest and impact the whole program, depending on the type of error. So, here are some common types of programming errors.</p><h3>2. What are considered common programming errors?</h3><p>In the good old days, way before our understanding of programming and coding as it is today, getting errors could be truly disastrous. Good thing for us that all modern coding approaches and debugging systems make it a lot easier for us to fix these errors whenever we get one. Seven common programming errors are encountered frequently in programming. They are Runtime errors, Logic errors, Compilation errors, Syntax errors, Interface errors, Interface errors, and Arithmetic errors.</p><h3>2.1. Runtime errors</h3><p>Runtime errors are coding errors that show themselves when a user tries to run the program. It got an error because something confused the program and caused it to crash. Runtime errors are also known as <a href="https://www2.microstrategy.com/producthelp/Current/CommandManager/WebHelp/Lang_1033/Content/html/Script_errors_Execution_errors.htm#:~:text=Execution%20errors%20occur%20when%20an,metadata%20generates%20an%20execution%20error.">execution errors</a>.</p><p>For example, user instruction could be in the wrong order, pointing to a step that hasn’t even been declared yet, or the user might have asked the computer to do something that doesn’t have to do with anything before that code. The simplest example here is <a href="https://www.parkersoftware.com/blog/the-most-common-coding-errors/">telling the computer to divide by zero</a>, which could result in an error. Another typical example that could happen is when users interact with a program unexpectedly. Runtime errors are the kind of error that can impact users from achieving what they want from the code. Here are some common mistakes that users made that led to getting runtime errors.</p><p>● Misspelled or incorrectly capitalized <a href="https://www.tutorialspoint.com/computer_programming/computer_programming_variables.htm">variable</a> and <a href="https://www.futurelearn.com/info/courses/programming-102-think-like-a-computer-scientist/0/steps/53095#:~:text=A%20function%20is%20simply%20a,which%20performs%20a%20particular%20task.">function names</a>.</p><p>● Attempts to perform operations, for example, math operations on the data in which data types are <a href="https://press.rebus.community/programmingfundamentals/chapter/string-data-type/">string values</a>.</p><p>● Dividing by zero</p><p>● Try to use a <a href="https://www.geeksforgeeks.org/type-conversion-in-python/">type conversion function</a> on a value that can’t be converted to an int</p><p>In the <a href="https://runestone.academy/ns/books/published/fopp/Debugging/RuntimeErrors.html#:~:text=Here%20are%20some%20examples%20of,variables%20that%20hold%20string%20values)">following program</a> about multiplying tax to the subtotal that the user has input, an error has occurred saying, <strong><em>“NameError: name ‘subT123otal’ is not defined. Did you mean: ‘subtotal’?” </em></strong>meaning <em>‘subT123otal’ </em>can’t be defined because it wasn’t declared at the top. So, in this case, the user misspelled the variable when he reused it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*4XRYH8SbADe1amUbUOCJoQ.png" /></figure><p>The following link will explain more types of runtime error examples and how to fix them.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fj4yKVe7ywrk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dj4yKVe7ywrk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fj4yKVe7ywrk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f3e272c9a361c649c94f6a1341a281b/href">https://medium.com/media/9f3e272c9a361c649c94f6a1341a281b/href</a></iframe><h3>2.2. Logic errors</h3><p><a href="https://python-textbok.readthedocs.io/en/1.0/Errors_and_Exceptions.html#:~:text=Here%20are%20some%20examples%20of%20mistakes%20which%20lead%20to%20logical,instead%20of%20floating-point%20division">Logical errors</a> can be extremely frustrating since everything is fine with the code. They are the most difficult to fix because the program runs without crashing but outputs the incorrect result. The programmer didn’t type the code as he intended, so the program output the result that the programmer didn’t want.</p><p>It is caused by a mistake in the program’s logic. It is the hardest to fix because you don’t get the error message, no syntax or runtime error to alert you that you did something wrong. You will have to find out by looking back at your code.</p><p>Sometimes it’s nothing wrong with the Python implementation of an algorithm, but the algorithm itself can be incorrect; however, most of the logic errors are caused by the carelessness of the programmer. Did you know a logical error caused by a miscalculation between American and English units <a href="https://www.simscale.com/blog/nasa-mars-climate-orbiter-metric/">caused NASA to lose a spaceship in 1999</a>? These are some examples of mistakes that lead to logical errors:</p><p>● Programmers use the wrong <a href="https://www.w3schools.com/python/python_variables_names.asp#:~:text=A%20variable%20name%20must%20start,AGE%20are%20three%20different%20variables)">variable name</a></p><p>● Indenting block to the wrong level</p><p>● Using <a href="https://www.educative.io/answers/what-is-integer-and-float-division-in-python">integer division instead of floating-point division</a></p><p>● Using the wrong formula, which leads to the wrong result</p><p>Suppose you misspell an identifier name or use the wrong variable name. In that case, you may get the runtime error if that misspelled variable doesn’t exist else. You will get the logic error if the misused one already exists, but you won’t get the error message, making things tricky and hard to detect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*cvPscgzEFaS-f7vHWVnv-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*BSbXy2c_ZbTmfMkm5HqewQ.png" /></figure><p>The <a href="https://geek-university.com/syntax-and-logical-errors/">example</a> above calculates the average of the two numbers the user enters. Still, because of how the order of operation is typed, the division evaluates before the addition, which is different from what we want. It should be <strong>(x+y)/2</strong>. Since it doesn’t mean an error to a program, it didn’t show any error message.</p><h3>2.3. Syntax errors</h3><p>Syntax errors have their own specialized rules, and when these rules are not followed and the programmer runs the code, a <a href="https://www.learnacademy.org/blog/what-considered-common-programming-errors/">syntax error</a> prevents the program from running. Python will find this error and exit your program without running anything. They are analogous to spelling or grammar mistakes like in English: “Have you the movie? “Which doesn’t make sense and missing a verb. Some of the <a href="https://python-textbok.readthedocs.io/en/1.0/Errors_and_Exceptions.html#:~:text=Here%20are%20some%20examples%20of%20mistakes%20which%20lead%20to%20logical,instead%20of%20floating-point%20division">standard Python syntax errors</a> are</p><p>● Leaving out the keyword</p><p>● Putting a keyword in the wrong location</p><p>● Leaving out symbols such as commas or semicolons, or brackets</p><p>● <a href="https://www.numpyninja.com/post/how-to-fix-indentation-error-in-python">Using the wrong indentation</a></p><p>● Empty block</p><p>In the <a href="https://realpython.com/invalid-syntax-python/">following example</a>, when the interpreter encounters invalid syntax in the program, it will raise a Syntax error and provide an error message with helpful information to the programmer, unlike a compilation error. In this case, you can see in line 4 a comma is missing at the end.</p><p>If you try to run the code, you will get the following error message saying invalid syntax and provide you with possible solutions like “Perhaps you forgot a comma?”</p><p>The following YouTube link has more examples of those three programming error types mentioned above. One of them is an example of syntax error.</p><h4>Syntax, Runtime, and Logical Errors in Python</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FToPP5UGgJUM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DToPP5UGgJUM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FToPP5UGgJUM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/09068f2a35c08e5e37206684a788fe7f/href">https://medium.com/media/09068f2a35c08e5e37206684a788fe7f/href</a></iframe><p>Can you spot the error? There are two errors you must fix for that code to run. Click the link and watch the video to see what the errors are.</p><h3>2.4. Compilation errors</h3><p>This error usually occurs when the code is built, but the program is failed to <a href="https://dev.to/arikaturika/code-compiling-explain-like-im-five-4mkj">compile</a>. If the code doesn’t compile, the program can’t be executed. The same as Logic errors and compile-time errors are a source of frustration to <a href="https://visualwebz.com/web-developers/">developers</a>, especially when they have just started learning the language. Unlike Logic errors, you do get the error messages, but they are unclear and don’t mean anything useful.</p><p>Long story short, <a href="https://www.learnacademy.org/blog/what-considered-common-programming-errors/">Compilation</a> is converting a high-level coding language into a low-level coding language that is easier to understand by the system. While doing that process, an error occurs when the compiler can’t translate the high-level code into the lower-level one. Causing this prevents the program from being launched or tested.</p><p>These are the <a href="https://www.theserverside.com/tutorial/The-most-common-compile-time-errors-in-Java">ten most common mistake</a> happened in Java compile time errors:</p><p>● <a href="https://www.folkstalk.com/2022/10/file-name-mismatch-with-class-name-with-code-examples.html">Java source file name mismatch</a></p><p>● Improper casting</p><p>● Mismatch brackets</p><p>● Missing semicolons</p><p>● <a href="https://www.delftstack.com/howto/java/the-method-is-undefined-for-the-type/">Method is undefined</a></p><p>● Variable already defined</p><p>● Variable not initialized</p><p>● Type mismatch: cannot convert</p><p>● Return type required</p><p>● Unreachable code</p><p><a href="https://www.theserverside.com/tutorial/The-most-common-compile-time-errors-in-Java#:~:text=Mismatched%20brackets,-A%20mismatched%20brace&amp;text=If%20the%20brackets%20don%27t,is%20a%20compile%20time%20error.&amp;text=The%20fix%20to%20this%20compile,System.">One of them is mismatched brackets</a> which is the cause of stress for <a href="https://seattlewebsitedeveloper.com/">programmers</a>. We know that every open bracket in the code requires a matching closed frame, but sometimes a programmer needs to remember the closing brackets after writing the code inside, which leads to compile time error. For example, the picture below shows the opening bracket is missing at println.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*xooSg3CRV7SAQT0OeyqHsw.png" /></figure><p>So, when it compiles, it reports the following error message, which hardly tells what’s the problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*LbfjTOULBgbIDyDR9en9wA.png" /></figure><p>Then when we put the missing open brackets to fix the problem, the error message goes away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*aKClIQt1c4NdxSI_23YF3A.png" /></figure><h3>2.5. Interface errors</h3><p>Most of the time, the program follows standards. If inputting of your program doesn’t conform to standards, you might get an interface error. These errors occur when there is a disconnection between what the programmer meant to be used and how it is used. An interface error might happen when you have an <a href="https://aws.amazon.com/what-is/api/">API</a> that needs that specific parameter to be set, but those parameters are not established.</p><p>Besides being handled correctly, interface errors will look like an error from your side, but it’s from the caller’s side. This can lead to frustration from both parties. That’s why having clear documents and recording these errors to pass back to the caller is the best way to handle this. In this way, it will keep support costs down and keep your client happy.</p><p>If you didn’t record these errors and pass them back to the caller, they would end up like runtime errors in your error message.</p><h3>2.6. Resource errors</h3><p>A program can force the computer it’s running to attempt to allocate more <a href="http://www.src.wits.ac.za/groups/psi/linux/rhl-sap-en-8.0/s1-bandwidth-processing.html">processor power</a>, <a href="https://www.intel.com/content/www/us/en/tech-tips-and-tricks/computer-ram.html#:~:text=RAM%20stands%20for%20random-access,as%20the%20processor%20needs%20it.">ram</a>, disk space, etc., than it has, which leads the program to crash or be bugged. Usually, the computer your program is running will allocate a certain number of resources. Still, sometimes your code forces the computer to try and allocate more resources than it has, resulting in <a href="https://textexpander.com/blog/the-7-most-common-types-of-errors-in-programming-and-how-to-avoid-them#:~:text=If%20input%20your%20program%20receives,those%20parameters%20are%20not%20set.">resource errors</a>.</p><p>If you accidentally write a loop that your code can never exit, like the one in the picture, you will eventually run out of resources on your computer. The loop will keep going for a while until it runs out of memory. Eventually, your computer will run out of memory. This type of error is hard to capture because the computer you are using can be high quality than the server running your codes, so it’s hard to replicate with your computer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*aYXiaJfo32Do9Gsp-Gz9LQ.png" /></figure><p>In this code in the picture above, a is set to 1 and put in the while loop where a is less than 10. Print that line and multiply a with 1, which will never be more than 1, and it keeps looping forever without exit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*D4Z0snK93T_IF-8MKUp1zQ.png" /></figure><p>After a certain amount of time and an infinite loop, your computer will have fewer memories and, eventually, run out.</p><h3>2.7. Arithmetic errors</h3><p><a href="https://www.learnacademy.org/blog/what-considered-common-programming-errors/">Arithmetic errors</a> are just like logic errors but with mathematics. For example, some division equations may require the program to divide by 0, which is mathematically impossible. It results in an error that prevents the software from running correctly. As mentioned, <a href="https://textexpander.com/blog/the-7-most-common-types-of-errors-in-programming-and-how-to-avoid-them#:~:text=If%20input%20your%20program%20receives,those%20parameters%20are%20not%20set.">arithmetic errors</a> can generate logic or sometimes even runtime errors when dividing by 0. To stop that, having <a href="https://www.mindfulqa.com/edge-cases/">functional tests that include edge cases</a> like 0 or negative numbers is an excellent way to prevent these errors.</p><p>The above picture shows an example of how arithmetic errors happen. The program tries to divide five by 0, which is mathematically impossible, and the program was told to print the answer. It turned out with an error message saying, “ZeroDivisionError: division by zero.”</p><h3>3. Conclusion</h3><p>Ultimately, we can’t escape from errors as long as we continue with <a href="https://seattlewebsitedesign.medium.com/how-to-achieve-on-budget-projects-2878155d9799">programming projects</a>. At some point, it is better to know these types of mistakes in advance so that when they appear in the future, you might learn a thing or two about them and can identify what type of error itis, which saves you time looking through everything on the internet. These are the seven most common errors in programming languages and their examples.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=784f2bb37a97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Essentials of Branching in Python]]></title>
            <link>https://seattlewebsitedevelopers.medium.com/the-essentials-of-branching-in-python-baef33f9ecc5?source=rss-eb6b2acff1ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/baef33f9ecc5</guid>
            <category><![CDATA[develoepr]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python-if-else-statement]]></category>
            <category><![CDATA[branching-in-coding]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Website Developer]]></dc:creator>
            <pubDate>Sun, 12 Feb 2023 13:16:40 GMT</pubDate>
            <atom:updated>2023-02-12T13:17:40.197Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction to Branching</h4><p>Branching is what allows the computer to make decisions and act intelligently. In programming, branching is when a program is split into two parts. The correct path is chosen based on a set condition. <a href="https://www.tutorialspoint.com/what-are-the-various-types-of-branches">There are two types of branching: conditional and unconditional</a>. Conditional branching statements rely on a condition to be met before making the code jump, and unconditional branching statements execute without a condition check. Generally, the main conditional branching statements revolve around using if, else-if, and else to specify required conditions. This tutorial will focus mainly on conditional branching statements.</p><p>Another way to describe branching is as any time a decision must be made. It is a common process in programming to execute different statements when certain conditions are met, and conditionals allow this to be done. Conditionals will only execute code if the condition stated by the programmer is true or false. The syntax “if”, “elif”, and “else” are used to denote a condition set by the programmer. These can be used in various combinations to create ladders and can even be placed inside each other to set more specific conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*nMBLtfZhs9i5y_T57VG8tg.png" /><figcaption><a href="https://www.exforsys.com/tutorials/c-language/decision-making-and-branching-in-c.html">https://www.exforsys.com/tutorials/c-language/decision-making-and-branching-in-c.html</a></figcaption></figure><p>Understanding the logic behind branching statements can be challenging at first, but knowing if a programmer desires to write productive and efficient code is a dire concept. Python is a language created for readability, which makes interpreting and using branching statements relatively easy. Each of the three branching statements can work together in any order, with the caveat that an “if” block must always be present first in a branching ladder.</p><h3>The “if” Statement</h3><p>First, let’s look at the most basic Statement, the “if” Statement. In programming, the “if” Statement has practically the same meaning as the English word “if”. An “if” Statement introduces a condition that may or may not be met, just like its use in English.</p><p><em>If I go to the store, I will buy coconut flakes.</em></p><p>In this sentence, the word “if” introduces the condition of going to the store. The second half of the sentence states what will happen if the condition is met: buying coconut flakes. In programming, the “if” Statement is used the same way and will generally have the following structure:</p><pre>if condition == true:<br>Block of code</pre><p>It is important to note that two equality symbols are used for logical equality.</p><p>Here is what some simple code may look like using an “if” Statement. For reference, the written code asks the user to enter a number; if that number is negative, it will print a statement.</p><p>Code:</p><pre>num = int(input())<br>if num &lt; 0:<br>print(&#39;The number is negative&#39;)<br>Output with input as &quot;-6&quot;:<br>The number is negative</pre><p>The program will output nothing in this code if a positive number is an input. Remember that <a href="https://medium.com/@alexbainter/computers-only-do-one-thing-3a7be8304208">computers are literal machines, doing only what you tell them to do</a>. If the number is positive, there is no condition telling what the computer should do with that number. This new condition can be set with an “else” statement. This is the second type of branching statement and can only be used if an “if’ statement was present beforehand.</p><p>It is also important to mention that spacing and colons are crucial when coding in python. A colon is to be always used after a branching statement is used, and proper spacing must always be used before the condition (pressing the “tab” key once). If a colon is not used or spacing isn’t used where required, your code will output an error message.</p><h3>The “else” Statement</h3><p>Next, consider another branching statement, the “else” Statement. The “else” Statement tells what the computer is to do if the condition is not met. The computer will read code in order from top to bottom (unless told otherwise), and when it comes to a branch, it will evaluate whether the condition for the first “if” Statement is met. An “else” statement also has a similar meaning and use to the English word, hinting at its purpose. The following structure illustrates how it is to be used.</p><pre>if condition == true:<br>Block of Code<br>else:<br>Block of Code</pre><p>When writing simple branches, the “else” Statement can be thought of as another “if” Statement that evaluates if the condition from before is false. However, this becomes inaccurate when combining this information with “elif” statements. With this structure in mind, the computer will only evaluate the “else” portion only if all other conditionals evaluate as “false”.</p><p>Now that we know what an “else” Statement is and how to use it, we can optimize our code from before slightly to tell the computer what to do if the number input is positive:</p><p>Code:</p><pre>num = int(input())<br>if num &lt; 0:<br>print(&#39;The number is negative&#39;)<br>else:<br>print(&#39;The number is positive&#39;)<br>Output with input as &quot;-6&quot;:<br>The number is negative<br>Output with input as &quot;5&quot;:<br>The number is positive</pre><h3>The “elif” Statement</h3><p>Finally, the third branching statement, “elif,” can be discussed. The first two branching statements may seem sufficient. However, just an “if” and “else” is not enough when one desires to set multiple conditions. This is where the “elif” statement can be used. The “elif” statement can theoretically be used an infinite number of times to set however many conditions are desired.</p><p><a href="https://www.w3schools.com/python/ref_keyword_elif.asp">The unabbreviated name of “elif” is “else-if”</a>, which may hint at its use. But it is different from an “else” statement because it can have a set condition. The computer evaluates an “elif” statement if and only if the original “if” condition is false.</p><p>When “elif” is used, its condition is checked only if the first “if” Statement evaluates as “false”.</p><pre>if condition == true:<br>(Code evaluates as false)<br>elif second condition == true:<br>Block of code executes</pre><p>Since the first condition was evaluated as false, the code began executing the second if condition, which was true. This would cause the code under the elif statement to execute.</p><p>It is important to note that “if” and “elif” have different meanings in a program and are used for specific situations. An “if” Statement cannot be used interchangeably with an “elif” statement, and vice versa. Using “elif” statements is often quicker than simply stacking many “if” statements.</p><p>Here is a graphic to help explain the connection between the three branching statements:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*FWDoXRu2mx4NAPArRcdc9A.png" /><figcaption><a href="https://www.codecademy.com/forum_questions/51684a3d4ce76309b4001b9c">https://www.codecademy.com/forum_questions/51684a3d4ce76309b4001b9c</a></figcaption></figure><p>Combining “if”, “else”, and “elif” Statements in a Single Branch</p><p>Consider watching the following YouTube video for any clarifications on branching:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FZp5MuPOtsSY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DZp5MuPOtsSY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FZp5MuPOtsSY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e90e90bfbeef07d3bd4886c3972a994/href">https://medium.com/media/3e90e90bfbeef07d3bd4886c3972a994/href</a></iframe><p>Now that all three main branching statements have been covered, it is appropriate to mention how they can all be combined into a single branch — using all three instead of repeated “if” statements is an excellent habit because <a href="https://www.pythonclassroom.com/decisions-if-elif-else/if-elif-else">using the trio is faster and more efficient to use in a program.</a> This is because when “elif” and “else” are combined with an “if”, once the computer identifies the branch that satisfies the condition, it will automatically be taken and void the other statements.</p><p>Any combination of these statements can be made, but it is usually most efficient to use all three statements in a single branch. Below is the general flow and structure of an average branch in a program:</p><pre>if condition == true:<br>Block of Code<br>elif second condition == true:<br>Block of Code<br>elif third condition == true:<br>Block of Code<br>else:<br>Block of Code</pre><p>Notice that after a single “if” Statement is used, “elif” statements begin to be used following it.</p><p>Using this information, it is possible to continue to optimize the code for identifying the value of a number. Currently, entering anything other than an integer will cause the program to output an error. Using some “elif” statements, these problems can be fixed.</p><p>Code:</p><pre>num = int(input())<br>if num &lt; 0:<br>print(&#39;The number is negative&#39;)<br>elif num &gt; 0:<br>print(&#39;The number is positive&#39;)<br>elif num == 0:<br>print(&#39;Zero is neither positive nor negative&#39;)<br>else:<br>print(&quot;Please input an integer&quot;)<br>Output with input as &quot;3&quot;:<br>The number is positive<br>Output with input as &quot;0&quot;:<br>Zero is neither positive nor negative<br>Output with input as &quot;ABC&quot;:<br>Please input an integer</pre><p>In addition to identifying the value of a number, the program now knows what to do if something other than an integer is entered. This program can be extended in many ways simply with more “elif” statements.</p><h3>Nested “if” Statements</h3><p>Furthermore, branching statements can be combined with other branching statements. In programming, this is known as a nested “if” Statement. This occurs when another branch is placed in the code of an original branch. This concept of “nesting” is prevalent in programming and used with other concepts and functions.</p><p><a href="https://www.cs.utah.edu/~germain/PPS/Topics/branching.html">“If” statements are the most used way to make decisions.</a> Because of this, they have the potential to be combined with almost any other programming function. Many times, branches will be placed inside other branches to create even more specific conditions for the desired output, and nested “if” statements have superb usability in Python and can easily simplify a task that may seem complex at first.</p><p>Here is how the general structure of a nested “if” Statement may look:</p><pre>if condition == true:<br>if second condition == true:<br>Block of Code<br>else:<br>Block of Code<br>else:<br>Block of Code</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*lLYDK-UUZTxjlZRec9kApg.png" /><figcaption><a href="https://www.programsbuzz.com/article/python-nested-if-statement">https://www.programsbuzz.com/article/python-nested-if-statement</a></figcaption></figure><p>In this code, the nested “if” will only be considered if the “if” condition above is true. Otherwise, the code will jump to the “else” Statement and disregard the nested if completely.</p><p>This technique is called a “control flow” and refers to using branches within each other. This concept of nesting does not apply only to branching statements and can be done with many different concepts like loops and user-defined functions. The video below may help you understand nested control flow statements:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FdePS_B7Loxs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdePS_B7Loxs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdePS_B7Loxs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd5a5e334635c245ef13a41e37e6bd03/href">https://medium.com/media/dd5a5e334635c245ef13a41e37e6bd03/href</a></iframe><h3>Common Problems and Issues Encountered</h3><p>Programming is a task of trial and error. It takes multiple attempts and time to determine what should be done to fix the bugs. Most likely, a program will not work as expected the first time around. Programming branching statements within code is no exception to this, and it takes time to learn how this job should be done.</p><p>Sometimes, the code is not working properly because the syntax needs to be written correctly. A beginner programmer may make this mistake multiple times and be frustrated as to why their program needs to be fixed. It is essential to pay attention to little details to ensure that branching statements are being written correctly. The most common mistake is forgetting to use two equal signs when setting a condition. Remember that the logical equality operator differs from the numerical equality operator, and misusing one will cause an error.</p><p>Additionally, forgetting to put colons after a branching statement will also cause an error. It is essential to ensure proper spacing before blocks of code beneath branching statements. All code under a branching statement requires the “tab” key to be pressed before typing. This applies to a nested “if” Statement as well.</p><p>Moving on from syntax typos, it is essential to understand that in an “if-elif-else” branch, the computer will disregard all other conditional statements as soon as something satisfies a condition. For example, in the code below, notice that “x” is more significant than both two and one. However, the code does not execute both conditionals, only the one that appeared first.</p><p>Code:</p><pre>x = 7<br>if x &gt; 1:<br>print(&#39;a&#39;)<br>elif x &gt; 2:<br>print(&#39;b&#39;)<br>else:<br>print(&#39;c&#39;)<br>Output:<br>a</pre><p>The program did not print out “b” or “c”, only “a” because it was the first condition that was satisfied. Note that if a programmer uses multiple “if” statements instead of an “if-elif-else” branch, then the program will individually check each “if” Statement instead of skipping all of them if it finds a satisfying condition. This is why an “if-elif-else” branch is computationally quicker than an “if-if-if” branch.</p><h3>Takeaway</h3><p>Branching is present in practically every program. <a href="https://johnysswlab.com/how-branches-influence-the-performance-of-your-code-and-what-can-you-do-about-it/">Statistically, every fifth instruction in a program is a branch.</a> Conditionals are the base decision maker and are usually the reason for the specific output of a program. There is a wide range of usages for conditionals, which can be combined with many other concepts in programming. Whenever a programmer needs a code to perform differently based on different interactions with the program, branching is used to achieve that. It is a process at the core of programming and must be adequately understood to have the ability to write more complex code.</p><p>Branching has seemingly endless possibilities for where it can be implemented and combined in infinite ways with other functions. <a href="https:seattlewebsitedeveloper.com/">Any developer</a>, whether for the web or mobile apps, will be familiar with branching and conditionals since it is a core part of software development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baef33f9ecc5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tutorial on the Python Library]]></title>
            <link>https://seattlewebsitedevelopers.medium.com/tutorial-on-the-python-library-6ca0a9ae074b?source=rss-eb6b2acff1ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ca0a9ae074b</guid>
            <category><![CDATA[importing-and-libraries]]></category>
            <category><![CDATA[python-libraries]]></category>
            <category><![CDATA[python-coding-help]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Website Developer]]></dc:creator>
            <pubDate>Sun, 12 Feb 2023 13:06:16 GMT</pubDate>
            <atom:updated>2023-02-12T13:06:16.954Z</atom:updated>
            <content:encoded><![CDATA[<p>When we think of libraries the average person probably envisions their local library down the street where they go to check out books. But when you stop to think about a library, you will find that it is a location where information is stored. Authors will write books where people can travel to this data storage, search for any specific information they want, then check that information out and use that piece of information for anything they want. A library in <a href="https://visualwebz.com/python/">Python</a> is a very similar concept, users will create files containing specific information for other users to import into their programs to perform various tasks. Throughout the course of this report, we will cover what exactly libraries in python are, give some examples of multiple types of libraries including uses, and how exactly a programmer can import and use a library within their own program. We will also go over some of the most common libraries used and some of the lesser-known types of libraries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*D5raddtob5LypmG2" /><figcaption><a href="https://ajaytech.co/what-are-python-libraries/">https://ajaytech.co/what-are-python-libraries/</a></figcaption></figure><h3>What are Python Libraries</h3><p>As previously mentioned, a library within python is simply a collection of data. To be more specific, a library is a collection of files within Python called “Modules”, most of the modules you find within python are user created since python is an open-source programming language. There are many different types of libraries out in the world of python, with each library having its own specific purpose. For example one would use the library “<a href="https://openpyxl.readthedocs.io/en/stable/">OpenPyxl</a>” or “<a href="https://www.geeksforgeeks.org/working-with-excel-files-in-python-using-xlwings/">Xlwings</a>” to read/write data to Microsoft Excel, create macros for automating processes, or generate graphical user interfaces using python as a means to communicate with excels programming language “VBA”(Visual Basic Analysis). Although Python does have many user-created libraries, it does come with many existing libraries pre-installed when you download Python onto your computer, these are called “<a href="https://www.geeksforgeeks.org/libraries-in-python/">Python Standard Libraries</a>”. These libraries have a wide variety of uses that a programmer could utilize in a multitude of situations. For example, one popular standard library is called “NumPy”, this stands for Numerical Python and is mainly used in mathematical computations. Whenever a user designs a program that needs to perform mathematical problem solutions such as machine learning, they use this library. One interesting fact is that libraries can also pull modules from other libraries, such is the case for a library called “TensorFlow”. This library is like NumPy in the aspect of complex mathematical problem-solving and machine learning, but the interesting thing about TensorFlow is that it actually imports modules from NumPy in order to perform some tasks.</p><h3>Importing and using Libraries</h3><p>In order for a programmer to use a library in their code they would need to first have that specific library downloaded and installed onto their computer. To do this a user will have to have python already downloaded onto their computer as a basic prerequisite and do one of two options. First, the user would have to open their command prompt and use a tool called “<a href="https://realpython.com/lessons/what-is-pip-overview/">pip</a>”, which is the pre-installed data package managing tool python uses to install new libraries that aren’t a part of the pre-installed python standard library. To install pip to install a library, the user would open their command prompt, and type in the command “py -m pip install” (Figure 1) followed by the name of the library they would want to download.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*Y9gX5E4U61a3uyUK7JfKtA.png" /><figcaption>Figure 1: Using pip install to download a python library</figcaption></figure><p>After this is complete the user would then have to open whatever IDE they plan to use and then proceed to <a href="https://www.geeksforgeeks.org/libraries-in-python/">import either that entire library into their program or segments of it known as modules</a> (Figure 2) into their program. I personally tend to only download certain modules I need within that library. You can see in Figure 2 that I opened my PyCharm IDE and have imported the library “OpenPyxl” and a specific module within that library called “openpyxl.cell”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*gPzZTmCxVhHd7UpxfyJt0A.png" /><figcaption>Figure 2: Importing library and specific module</figcaption></figure><p>The second method to install and import libraries within python would be to simply just do it through your IDE, in this scenario it is PyCharm specific. A user would open their IDE, type “import” followed by the name of the of the library you would like to import. If the library is installed onto the user’s computer already it will simply just import the library. But if the user doesn’t have the library installed prior, PyCharm will highlight the segment of text in red prompting the programmer to right click on it and select “install package” (Figure 3).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*eOFrjSw1BIx0Qfw31FBaYg.png" /><figcaption>Figure 3: Installing library through PyCharm</figcaption></figure><p>In this scenario you can see that I have gone into my PyCharm editor and typed in the command “Import Xlwings”, I did not have this library installed prior to this so the section of code was highlighted red. I then right clicked on the red highlight, and it is now prompting me to install that package.</p><h3>Common Python Libraries</h3><p>Two of the most common python libraries that have been widely popularized due to the easy-to-use artificial intelligence interfaces are known as <a href="https://www.simplilearn.com/keras-vs-tensorflow-vs-pytorch-article">Keras and Pytorch</a>. Both of these libraries specialize in the creation of machine learning and artificial intelligence. They both utilize a series of large datasets and neural networks to help the AI learn and grow. A neural network is named after the human brain; this is because a neural network actually mimics the functionality of how neurons are fired within the human brain. At its heart, a neural network is a cluster of “nodes” that contain inputs, a setpoint, and an output, all nodes are intertwined together, and each node won’t activate unless the adjacent nodes setpoint triggers it to activate. theses libraries are simply popular because they are easy to use while creating these node datasets. Of the two <a href="https://www.youtube.com/watch?v=4Yy4ooOg69s">Keras</a> is the most popular option, Keras offers a more plug-and-play method of programming that newer programmers find less intimidating. This also allows for programs to be created, compiled, and executed faster than if programmed using Pytorch. Another feature that draws newer programmers to Keras is the fact that models within Keras are easier to export and manipulate, this saves time when initially developing the program you want to create. Pytorch on the other hand is more popular with more experienced programmers due to it being able to work with larger datasets and having more extensive debugging capabilities that make it easier for <a href="https://seattlewebsitedeveloper.com/where-to-find-web-developers/">developers</a> to go back and fix any errors they may find at a later time. Below is an example video on how exactly a user would set up and use tools within Keras.</p><h3>Keras Library How-To Video</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F4Yy4ooOg69s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D4Yy4ooOg69s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F4Yy4ooOg69s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0fcd0e3fe652b7a2ae515c044969c095/href">https://medium.com/media/0fcd0e3fe652b7a2ae515c044969c095/href</a></iframe><h3>Lesser-Known Python Libraries</h3><p>So far, we have covered what a generic definition of a library is within Python, how to install and use some of these libraries, and what some of the most common types of libraries are within Python. Now we will move on to some of the lesser-known libraries in Python, what their uses are, and how they could be just as useful as some of their more popular counterparts. One lesser-known python module is one called Tabulate. Tabulate is a library that allows users to manipulate tabular datasets within python. A tabular dataset could be a data frame, a list of lists or dictionaries, or even a dictionary itself. The interesting thing about tabulate is that it doesn’t manipulate the values of the data itself but rather manipulates the way in which the data is formatted. Tabulate presents all of the data in the form of a table! This makes presenting the data easier for the user to read and understand what is happening within the data. Here is an example of a neatly formatted tabulate table presenting a list of animals.</p><p>- — — — — — — — — — — — — — — — — — — — — — — — -</p><p>Jadzia Domestic Short Hair Female Stray</p><p>Gonzo German Shepherd Dog/Mix Male Stray</p><p>Maggie Shep Mix/Siberian Husky Female Stray</p><p>Pretty Girl Domestic Short Hair Female Stray</p><p>Pretty Girl Domestic Short Hair Female Stray</p><p>— — — — — — — — — — — — — — — — — — — — — — — -</p><p>Another lesser-known library is one called <a href="https://www.dataquest.io/blog/8-rarely-used-python-libraries-how-to-use-them/">Numerizer</a>, this library is used in order to generate text-based numerical entries within a table or data set into an actual integer or float data types. For example, if one were to type out the word seven, then use Numerizer, the library would read and decode that word and spit out an output of “7”. This could be useful if a programmer was developing and commissioning a sort and search program. Lastly, we have a library that could add a little bit of fun to a developer’s program called <a href="https://www.dataquest.io/blog/8-rarely-used-python-libraries-how-to-use-them/">Emoji</a>. Emoji is a library in Python that allows the developer to insert fun emoji images into the program that they are creating. This could be used in various types of games one would develop in python, maybe a programmer would like to give players a fun Easter egg within the game or add a bit of flare at the end of the game for a winning player or even assign different emoji images to identify different players within a game. Below is an example of what it would look like for a programmer to use Emoji to add emoji’s to a python program. Below is a how-to guide on how to use the Emoji Library in Python for further clarification.</p><h4>Emoji How-To Video</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FAkEJMKzRvPg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DAkEJMKzRvPg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FAkEJMKzRvPg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/53d91abf519c93c8438a2242e1e9c74c/href">https://medium.com/media/53d91abf519c93c8438a2242e1e9c74c/href</a></iframe><p><strong>Emoji Code Example</strong></p><pre>import emoji<br>rint(emoji.emojize(&#39;:koala:&#39;))<br>rint(emoji.demojize(&#39;&#39;))<br>rint(emoji.emojize(&#39;:rana:&#39;, language=&#39;it&#39;))</pre><h3>Takeaway</h3><p>We have learned an in-depth description of what libraries in python are. We have learned two ways to install libraries onto our computer to use in our programming: one using pip install and the other using the install tools directly built into PyCharm. We have also seen some images showing some uses of modules within Python. We have also gone over some of the most common libraries contained within Python such as Keras, Pytorch, Numpy, and TensorFlow to name a few. We have also covered some of the not-so-common libraries within python such as Tabulate for formatting data into tables for easier presentation, Numerizer which is used to convert string data types into integer or float point data types for search functions, and emoji which is a library used for fun more than it is for work, this library allows programmers to insert popular and fun emoji images into a program. Every library has its place and specific use, some libraries are similar to one another and some are very original but each one is no less useful than the other.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ca0a9ae074b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>