<?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 Andrew Dass on Medium]]></title>
        <description><![CDATA[Stories by Andrew Dass on Medium]]></description>
        <link>https://medium.com/@andrewdass?source=rss-e8132488d19b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*PvggvNsNo1eVha2j.jpg</url>
            <title>Stories by Andrew Dass on Medium</title>
            <link>https://medium.com/@andrewdass?source=rss-e8132488d19b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 04:30:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@andrewdass/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[Python: Errors, Exceptions and the Raise Keyword]]></title>
            <link>https://medium.com/@andrewdass/python-errors-exceptions-and-the-raise-keyword-f5226ccbcf19?source=rss-e8132488d19b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5226ccbcf19</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[error]]></category>
            <category><![CDATA[exceptions-in-python]]></category>
            <category><![CDATA[python3]]></category>
            <dc:creator><![CDATA[Andrew Dass]]></dc:creator>
            <pubDate>Tue, 01 Apr 2025 16:12:33 GMT</pubDate>
            <atom:updated>2025-04-01T16:12:33.553Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eEQ9mD8NS4KioXsxRTSolw.png" /></figure><h3>Overview: What an Error and Exception is</h3><p>This article will explain in the Python Programming Language, how a few different errors can be triggered when there are certain Python syntax mistakes when a Python script or code is run. Exceptions (1) can be implemented to catch different errors by using try and except statements to catch and even bypass an error and continue running the remainder of the Python script. An exception can also be triggered by using the “raise” keyword, which will also be demonstrated.</p><h3>Materials</h3><ul><li>Computer</li><li>Python (2)</li></ul><h3>Different Errors</h3><p>Below are examples of different errors that can happen.</p><h4>Assertion Error</h4><p>The keyword “assert” validates if a statement is True. If the statement is False, then an assertion error occurs. The statement 3 == 3 is True but not the statement 3 == 4, therefore, an assertion error would occur.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*rgyh6oqQ0v4rBI3B-IhJQA.png" /></figure><h4>Arithmetic Error</h4><p>An arithmetic error occurs when there is a problem with a mathematical statement. An arithmetic error is the most general error that occurs when there is a mathematical problem in the code. Common arithmetic errors are called type error, value error, or zero-division error.</p><h4>Type Error</h4><p>A type error occurs when a different data type is incorrectly used with another data type. Below shows an example, where a string data type is trying to be added to an integer. Of course, it is not possible to add a number with a string and receive a numerical result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*TuuFD5hLx4WYstcIWxCVOQ.png" /></figure><h4>Value Error</h4><p>A value error occurs when there is a statement that is incorrectly casted, or a value cannot be displayed due to certain conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*c9SvFLgdwz0GHBbxuSb8WA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lb8p3E13BaPn9jm7VJhf-w.png" /></figure><h4>Zero-Division Error</h4><p>A zero-division error is when division occurs where the denominator number is a zero. Dividing any number by zero does not exist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*HBphZJvPAMk3R6Xv0LddGQ.png" /></figure><h4>KeyBoard Interrupt</h4><p>A keyboard interrupt error can occur if a variable asks the user for an input, but CTRL + C is pressed instead to exit out and cancel the running script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IEDaweJmjEBNP7HWiuQ4Gg.png" /></figure><h4>Import Error</h4><p>An import error occurs when a module is imported but a function that does not exist is trying to be used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3boUL6qgaZlZ2YIzjV0YTg.png" /></figure><h4>Module Not Found Error</h4><p>A module not found error occurs when a file or a module is trying to be imported and there seems to be an error for one of the possible reasons: the file that is being read is in the wrong directory or does not exist, the package is not installed on the system to use the module or the name that is written after “import” is incorrectly spelt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*p3e6-eYUgnTRl0Xwx_RLDw.png" /></figure><h4>Lookup Error</h4><p>A lookup error occurs when searching for an element from a certain data type is not found. Common lookup errors are index errors and key errors.</p><h4>Index Error</h4><p>An index error occurs when an element is trying to be accessed from a data type that exceeds or is below its index. Remember, that elements from a list can be accessed using negative numbers too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*IA1kYDiM1GsQw-lKHya3Wg.png" /></figure><h4>Key Error</h4><p>A key error occurs when trying to access a key from a dictionary that does not exist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OMExue5Q7wudj2ghPe_0Vw.png" /></figure><h4>Memory Error</h4><p>A memory error occurs when a Python script takes too long to run a command or commands because it requires a lot of memory to store the result in real-time, therefore, it will crash because there is no more memory left to complete the script’s output.</p><h4>Name Error</h4><p>A name error occurs when trying to print out a variable that does not exist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*nVBfuDbwj0tgdUZMwMtXig.png" /></figure><h4>Overflow Error</h4><p>An overflow error occurs when the result of a mathematical operation outputs too many digits. The terminal will not output the result but instead stay blank unless the user manually exits out of the process, or it throws an overflow error. Below shows an image of 10 being raised by a large number, and the output will not be displayed on the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VCfGpE8z5zqpMDko1L9WTQ.png" /></figure><h4>Syntax Error</h4><p>A syntax error occurs when a statement is entered in Python, but it is written incorrectly, or something is missing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*LlK6zTVMEqwEVP3Wk5HdrA.png" /></figure><h4>Errors Script</h4><p>Below is the script that was used to receive the many errors shown above. Before running, uncomment the code to replicate the errors.</p><pre># Different Exceptions<br><br># Assertion Error<br># assert == 4<br><br># Arithmetic Errors:<br><br># Type Error<br># print(3 + &quot;hi&quot;)<br><br># Value Error<br># print(int(&quot;hi&quot;))<br><br># Zero-Division Error<br># print(3 / 0)<br><br># KeyBoard Interrupt<br># write_something = input(&quot;Enter a word: &quot;)<br># When running the write_something variable, press CTRL + C to exit out when asked of an input<br><br># Import Error<br># from math import s<br><br># Module Not Found Error<br># import insert_module_name<br><br># Lookup Errors<br># Index Error<br># a_list = [1,2,3]<br># print(a_list[3])<br><br># Key Error<br># a_dictionary = {&quot;one&quot;: 1, &quot;two&quot;: 2}<br># print(a_dictionary[&quot;three&quot;])<br><br># Name Error<br># print(Hello)<br><br># Overflow Error<br># 10 * 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000<br><br># Syntax Error<br># print(3 + )</pre><h3>How to use Exceptions in a Python Script or Code</h3><p>Exceptions are often used with try and except statements to catch specified errors by the user. It is optional for a try and except statement to include an else or finally block, and it can be written in the following format:</p><pre>try:<br>    # Write code for the Python script to run<br>except:<br>    # This block of code runs only if an error occurs in the try block<br>else:<br>    # This block of code runs only if no errors were detected in the try block<br>finally:<br>    # This block of code always runs</pre><h4>Examples of using try and except Blocks</h4><p>Below shows how to write a try and except statement:</p><pre>try:<br>    print(3 / 0)<br>except:<br>    print(&quot;An error occurred&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*iG2blEqzqq7bn71mGOh4sg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*5upC6EmZtCsYG5mOlWj50A.png" /></figure><p>Usually, running three divided by zero would result in a Zero-Division Error, but the most general code to catch any exception would be is to specify the word “except:” or “except Exception:”. To run this code optimally, the except statement can specify a particular error:</p><pre>try:<br>    print(3 / 0)<br>except ZeroDivisionError:<br>    print(&quot;An error occurred&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*AdW7Ospz2I_VPpYCOTLNJg.png" /></figure><p>It is possible to include more than one except statement and the order matters. Since specifying except will catch any error, it is not possible to write “except” and then include another except statement that particularly specifies one error statement. If more than one except statement is in the try and except block, it has to be written as shown below.</p><h3>try and block Script</h3><pre>try:<br>    num1 = int(input(&quot;Enter a number: &quot;))<br>    num2 = int(input(&quot;Enter another number: &quot;))<br>    print(num1/num2)<br>except ZeroDivisionError:<br>    print(&quot;Can&#39;t have a denominator number by 0&quot;)<br>except:<br>    print(&quot;An error occurred&quot;)<br>else:<br>    print(&quot;No errors detected&quot;)<br>finally:<br>    print(&quot;Code is finished running&quot;)</pre><p>If the zero division error is not triggered, then the other except statement will catch any other errors if any has occurred. If not except statements has occurred, then the else statement will occur after the try statement. The finally block will always run after the try and except blocks, or the try and else blocks.</p><h4>Different Scenarios of using try and except:</h4><p><strong>Dividing a number by Zero:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MoSs_qexoisao1q5sYNE6Q.png" /></figure><p><strong>Detecting a Different Error:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oxXE3cdPR8sVi1HprYLQmQ.png" /></figure><p><strong>No Errors Were Detected:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L-ThH5HpQmZjOt7ucnZ-zA.png" /></figure><h3>Giving Exceptions Different Names and How to Use the Raise Keyword</h3><p>Exception name blocks can be renamed in a different way by using the keyword as and then state a word in order to give it another name.</p><pre>try:<br>    print(3/0)<br>except Exception as e:<br>    e</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*nHgTmsMHieJ7dgtRfsQPhw.png" /></figure><p>To print the details of the error to the terminal, the keyword “raise” is needed</p><pre>try:<br>    print(3/0)<br>except Exception as e:<br>    raise e</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nllQ3-9lNIkmQd8oHZVsVg.png" /></figure><h3>Sources</h3><p><a href="https://docs.python.org/3/library/exceptions.html">https://docs.python.org/3/library/exceptions.html</a> (1)</p><p><a href="https://www.python.org/downloads/">https://www.python.org/downloads/</a> (2)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5226ccbcf19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to write SQL Commands in the Python Programming Language]]></title>
            <link>https://medium.com/@andrewdass/how-to-write-sql-commands-in-the-python-programming-language-3a2d681ab9e2?source=rss-e8132488d19b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a2d681ab9e2</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[python3]]></category>
            <dc:creator><![CDATA[Andrew Dass]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 12:45:48 GMT</pubDate>
            <atom:updated>2025-03-24T12:45:48.407Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3j7Me3fmsgD_0yAv4lfn8A.png" /></figure><h3>Overview</h3><p>This article explains how to write SQL commands in the Python Programming Language to create databases and edit information in databases.</p><h3>Materials</h3><ul><li>MySQL (1)</li><li>Python (2)</li></ul><h3>Procedure</h3><p>During the installation of MySQL, it asks the user to make a database. Remember the username and password of the created database, because both are needed to enter the database. In this demonstration, the username of the database is called root.</p><p>To run MySQL commands and to make a MySQL database in a Python script, install the module “mysql-connector-python” (3) first.</p><pre>pip install mysql-connector-python</pre><h4>Steps Explaining How to Make the Python Script</h4><p>To run the MySQL module, write the following below:</p><pre>import mysql.connector</pre><p>Next, declare a variable that uses the “mysql.connector.connect()” and have a database currently running in MySQL. The parameters “mysql.connector.connect()” uses are user, password and host. When a MySQL database is created, a name for the user and password must be configured to access the database each time afterward. Every database runs on a port, and by default it runs on 127.0.0.1:3306. A variable usually named cursor is declared to eventually send and execute commands to the connected database and store, delete and display information from the database.</p><pre>cnx = mysql.connector.connect(user=&#39;...&#39;, host=&#39;127.0.0.1&#39;, password=&#39;...&#39;)<br>cursor = cnx.cursor()</pre><p>After declaring the cursor, variables in Python can be declared to execute a command that uses SQL syntax. Below shows the “make_database” variable, will make a database by using the SQL command “create database”.</p><pre>make_database = &quot;create database name_of_database&quot;</pre><p>Once again, the cursor variable is needed to execute the SQL command or variable that contains the SQL command by performing “cursor.execute(…)”.</p><pre>cursor.execute(make_database)</pre><p>Afterwards, run the command “show databases” and a for loop to retrieve and display information from the cursor, and it will display the changes.</p><pre>list_of_databases = cursor.execute(&quot;show databases&quot;)<br><br>for i in cursor:<br>    print(i)</pre><h4>Final Python Script Integrating MySQL</h4><pre># 1st import the module<br>import mysql.connector<br><br># 2nd: connect to database, both lines of code down below is essential<br>cnx = mysql.connector.connect(user=&#39;...&#39;, host=&#39;127.0.0.1&#39;, password=&#39;...&#39;)<br><br>cursor = cnx.cursor()<br><br># 3rd: write sql code: <br>make_database = &quot;create database name_of_database&quot;<br><br># 4th: execute<br>cursor.execute(make_database)<br><br># 5th: show changes or databases<br>list_of_databases = cursor.execute(&quot;show databases&quot;)<br><br>for i in cursor:<br>    print(i)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R-6IZGXPIZX4LkhY1lHZ1Q.png" /></figure><p>This Python script is also available on Github (4)</p><h4>Output from Python Script</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wkd25f42devMTRFxauW2RQ.png" /></figure><h3>Sources</h3><p><a href="https://dev.mysql.com/downloads/">https://dev.mysql.com/downloads/</a> (1)</p><p><a href="https://www.python.org/">https://www.python.org/</a> (2)</p><p><a href="https://dev.mysql.com/doc/connector-python/en/connector-python-installation-binary.html">https://dev.mysql.com/doc/connector-python/en/connector-python-installation-binary.html</a> (3)</p><h3>Source Code</h3><p><a href="https://github.com/AndrewDass1/TUTORIALS-AND-NOTES/tree/main/Python/SQL/Integrating%20Python%20and%20SQL%20together">https://github.com/AndrewDass1/TUTORIALS-AND-NOTES/tree/main/Python/SQL/Integrating%20Python%20and%20SQL%20together</a> (4)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a2d681ab9e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use MySQL Shell]]></title>
            <link>https://medium.com/@andrewdass/how-to-use-mysql-shell-7904cd144463?source=rss-e8132488d19b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7904cd144463</guid>
            <category><![CDATA[mysql]]></category>
            <dc:creator><![CDATA[Andrew Dass]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 12:40:52 GMT</pubDate>
            <atom:updated>2025-03-24T13:05:50.783Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting Started on How to use MySQL Shell</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7I9tSsTDhj6SU0atb1MQwQ.png" /></figure><h3>Overview</h3><p>This article explains how to use SQL commands with MySQL Shell to create databases and view information in a database.</p><h3>Materials</h3><ul><li>MySQL (1)</li><li>MySQL Shell</li></ul><p>When downloading MySQL, it installs MySQL workbench, which is an interactive graphical user interface and shell where the user can view, make and perform changes to a database. Another software is also installed called MySQL Shell, which this tutorial will focus on using this software if people prefer just using a shell.</p><p>During the installation of MySQL, it asks the user to make a database. Remember the username and password of the created database, because both are needed to enter the database. In this demonstration, the username of the database is called root.</p><h3>Procedure</h3><h4>Using MySQL Shell to Access the Database</h4><p>To check if the database was created, open MySQL Shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R4iYDv2O6vt5LCEJ.png" /></figure><p>By default, it’s in JS or JavaScript mode. To switch to SQL mode, type the command “\sql” and press enter. Every command that’s typed into the shell, must be entered afterward to execute a shell command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*acrRGMz9IRcRWclL.png" /></figure><h4>Clearing the MySQL Shell</h4><p>If there are too many commands in the MySQL shell, type “\! cls” to clear the terminal and have a blank screen</p><pre>\! cls</pre><p>Connect to the database by running the “\connect” command. When using the connect command, the username of the database, localhost and the port the database runs on is needed. Below shows the syntax of connecting to a running database:</p><pre>\connect username@localhost:port_number</pre><p>Once again, in this tutorial, the username is root and the port number is 3306. When a database is running locally on a computer, the default port to run locally is 3306.</p><pre>\connect root@localhost:3306</pre><p>After running the command, enter a password. To access this database in the future, remember the username and password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J1m5ECWgRiCuSkeR.png" /></figure><p>Then, run the command “show databases” to check the current databases that are there</p><pre>show databases;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P9YnMXhwi6Y7Sm8I.png" /></figure><p>To make a database, use the command “create database” and specify the name of the database</p><pre>create database give_name_to_database;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8IFdbIuqE2S50zt9.png" /></figure><p>Run the command, “show databases;” to see the changes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/0*tk3bw1qh3_eWcs8e.png" /></figure><p>Aside from using the SQL workbench, the SQL Shell is another way to create and edit databases.</p><h3>Sources</h3><p><a href="https://dev.mysql.com/downloads/">https://dev.mysql.com/downloads/</a> (1)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7904cd144463" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python: How to Make and Use Single Line For Loops]]></title>
            <link>https://medium.com/@andrewdass/python-how-to-make-and-use-single-line-for-loops-3dbadb2ab811?source=rss-e8132488d19b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dbadb2ab811</guid>
            <category><![CDATA[for-loop-in-python]]></category>
            <category><![CDATA[python3]]></category>
            <dc:creator><![CDATA[Andrew Dass]]></dc:creator>
            <pubDate>Wed, 22 Jan 2025 12:25:39 GMT</pubDate>
            <atom:updated>2025-01-22T12:25:39.336Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SNzt9av5IkMN5eXf4_eeTQ.png" /></figure><h3>Overview</h3><p>This article will explain how to create a for loop in one line of code and why and when using this is preferred than the standard for loop syntax.</p><h3>Standard For Loop Syntax</h3><p>A for loop is written with at least two lines:</p><pre>for i in range(0, 3):<br>    print(i)</pre><h3>How to create a One Line For Loop</h3><p>Instead of writing “print(i)” on the next line, it can be written after the colin or “:”</p><pre>for i in range(0, 3): print(i)</pre><h3>Using a Single Line For Loop to Print Lists</h3><p>A single line for loop can also print out a statement or variable that contains a casted list statement. Usually, the for loop sentence is written first and then on the next line, the statement to print out a certain result is written. In a one line for loop statement, the variable is written first and then the for loop statement.</p><pre>&#39;&#39;&#39; Below shows the variable numbers_in_a_list is <br>assigned to data that is casted within a list &#39;&#39;&#39;<br><br>numbers_in_a_list = [number for number in range(1, 10)]<br>print(numbers_in_a_list)</pre><h3>Using Single Line for Loops for Lambda Functions</h3><p>In Python, lambda functions are written in one line to first declare variables and then a statement that uses the declared variables to perform an operation. Single line for loops are often used with lambda functions.</p><h3>How to make a Lambda Function</h3><p>Below shows how to make a lambda function. The word “lambda” has to be written first and then declare as much variables as needed. After declaring the variables, a colin or “:” is written and a statement to perform an operation that uses the declared variables.</p><pre>addition = lambda var1, var2: var1 + var2<br>print(addition(2,3))<br># Output: 5</pre><h3>How to use a Single Line for Loops with Lambda Functions</h3><p>Single line for loops is often recommended to be used with Lambda functions where the statement is formatted in a list:</p><pre>subtraction = lambda x, y: [x-y for i in range(0,4)]<br>print(subtraction(2,5))<br># Output: [-3, -3, -3, -3]</pre><p>The usual way of writing a one line for loop will not work with a lambda function because the colin or “:” would be repeated twice and then Python has trouble reading the syntax.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dbadb2ab811" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python: How to use the Lambda Function]]></title>
            <link>https://medium.com/@andrewdass/python-how-to-use-the-lambda-function-bb49a91c7e3c?source=rss-e8132488d19b------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb49a91c7e3c</guid>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[lambda-function]]></category>
            <dc:creator><![CDATA[Andrew Dass]]></dc:creator>
            <pubDate>Wed, 22 Jan 2025 12:24:34 GMT</pubDate>
            <atom:updated>2025-01-22T12:24:34.098Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ii52TvHncKU1koXT0J41xA.png" /></figure><h3>Overview</h3><p>This article will explain what a Lambda function is in Python, the syntax for it and how to use it.</p><h3>What is the Lambda Function</h3><p>The Lambda function is an expression that can be customized to take the keyword “lambda”, variables and a statement to use those variables to perform a calculation. Other variables can also be assigned to use a lambda function.</p><h3>Syntax of a Lambda Function</h3><p>Below shows the syntax of a lambda function and examples how to use it:</p><pre>lambda name_of_variable1, name_of_variable2...... : mathematical statement</pre><p>The keyword “lambda” is needed, then all the names of the variables after. Then the colin or “:” is needed and then a statement to perform an operation with those variables.</p><h3>Lambda Example</h3><pre>add_two_variables = lambda var1, var2: var1 + var2<br><br>print(add_two_variables(3, 5))<br># Final Result: 8</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb49a91c7e3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python: Updated Object Oriented Programming and Classes Tutorial]]></title>
            <link>https://medium.com/@andrewdass/python-updated-object-oriented-programming-and-classes-tutorial-f2b24792e115?source=rss-e8132488d19b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2b24792e115</guid>
            <category><![CDATA[classes-and-objects]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[object-oriented]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Andrew Dass]]></dc:creator>
            <pubDate>Mon, 20 Jan 2025 13:24:58 GMT</pubDate>
            <atom:updated>2025-01-20T13:24:58.064Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OltJX22pK1ZqZ-3xe0bZxQ.png" /></figure><h3>Overview</h3><p>This article will explain the basics and how to use Object Oriented Programming when using classes in the Python programming language.</p><h3>Materials</h3><ul><li>Python</li><li>IDE</li></ul><h3>What is Object Oriented Programming?</h3><p><strong>Object oriented programming </strong>fully utilizes the concept of objects. In any programming language, an <strong>object </strong>is a variable that holds data. For example, the String variable below is an object:</p><pre>text = &quot;hello&quot;</pre><p>The object “text” holds the string data “hello” if printed.</p><p>Another word or synonym for object creation is the word <strong>instantiation. </strong>Data is used to create or <strong>instantiate </strong>an object. Once again, the concept and the definition of objects in programming, is more specific when referred in the context of Object-Oriented Programming.</p><p>In Object-Oriented Programming, <strong>classes </strong>are an organized layout of code that is used to create objects in order to access and print object data or their <strong>attributes </strong>or <strong>methods </strong>more efficiently and securely.</p><h3>How to make a Class</h3><p>To create a class is created by doing the following:</p><pre>class Name_Of_The_Class:<br>    pass</pre><ul><li>To make a class, first write the word “class” then make a name for the class. The class’s name must be capitalized. Afterwards end it with a colin or “:”</li><li>Then press enter and a tab and begin writing within the class block. Above shows the simplest class, where only the keyword pass is within the class. It’s still a functionable class but since it only includes “pass” it won’t perform any significant changes.</li></ul><h3>Using Methods to Print Attributes from a Class</h3><p>An attribute (1) is accessing a variable’s data from within a class. A method must be declared to print the class’s variable data, and that can be done by using the class name, then a dot, then the name of the attribute or variable within the class.</p><pre>class Name_Of_The_Class:<br>    first_variable = 1  # A class variable and an attribute<br>    second_variable = 2<br><br># How to print Attributes<br>print(Name_Of_The_Class.first_variable)<br>print(Name_Of_The_Class.second_variable)</pre><h3>Using Methods to Print Function Data from a Class</h3><p>A method is returning data from a function that is within a class. To print a method, first write the name of the class, followed by a dot, and then the function name with the parenthesis:</p><pre>class Name_Of_The_Class:<br>    def function():<br>        function_variable1 = 3<br>        return function_variable1<br><br># Printing a Class Function by using Method<br>print(Name_Of_The_Class.function())</pre><p>A method in Python outside of OOP usually also follows the same syntax, that a variable is first needed, then a dot, then a built-in method to print some data.</p><h3>Constructors</h3><p>A constructor is a special function that is used to create new objects and uses a placeholder parameter to access other variables (2). <strong>The placeholder parameter is usually called “self”, but it can have a different name. </strong>Below is the format of a constructor:</p><pre>def __init__(self, variable1, variable2............last_variable):<br>    self.variable1 = &quot;hello&quot;<br>    self.variable2 = &quot;there&quot;</pre><h3>Printing Variables from a Constructor</h3><p>Below shows an example to print variables from a constructor, however, this way is not ideal as it does not use the self-parameter correctly:</p><pre>class Shapes:<br>    def __init__(self, shape1, shape2):<br>        self.shape1 = shape1<br>        self.shape2 = shape2<br><br>the_shapes = Shapes(&quot;Triangle&quot;, &quot;Square&quot;)<br>print(the_shapes.shape1)<br>print(the_shapes.shape2)</pre><h3>How to use Self in a Constructor</h3><p>Below shows how to use self in a constructor (3):</p><pre>class One:<br>    def __init__(self, variable1):<br>        self.variable1 = variable1 # An instance attribute<br><br>    def print_the_variable(self):<br>        return self.variable1<br><br>the_instance_variable = One(&quot;hi&quot;).print_the_variable()<br>print(the_instance_variable)</pre><p>When working with classes, the word instance will also be used quite often. An instance is a variable that is created that prints a class’s values from the constructor.</p><p>Once again, <strong>self is the default name for the parameter to access other variables, </strong>it can have another name. Below shows the same example as above where the self-parameters have different names:</p><pre>class One:<br>    def __init__(insert_parameter_name, variable1):<br>        insert_parameter_name.variable1 = variable1<br><br>    def print_the_variable(write_another_parameter_name):<br>        return write_another_parameter_name.variable1<br><br>print( One(&quot;hi&quot;).print_the_variable() )</pre><h3>Public vs Private Variables</h3><p>Any object that has two underscores before its name as shown below, is considered to be private and not public. <strong>Private data cannot be printed through class methods. </strong>Constructors are an example of private data too.</p><pre># Public<br>self.variable1 = <br><br># Private<br>self.__variable1 =</pre><p>Below shows an example of a class that has a private variable, and when trying to print the private variable directly without using the function, it will cause an error:</p><pre>class example_class:<br>    def __init__(self, variable1):<br>        self.__variable1 = variable1<br><br>    def function(self):<br>        return self.__variable1<br><br>access_the_class = example_class(&quot;Hello&quot;)<br>print(access_the_class.function()) #This line of code will print the private variable<br>print(access_the_class.__variable1) #This line of code will NOT print the private variable</pre><h3>How Subclasses Can Overwrite Variables</h3><p>There can be a scenario where the variable data in a superclass can be overwritten by its subclasses if the declared variables within the superclass and subclasses share the same variable names, and this should be avoided in some scenarios to not cause any problems. Below shows the superclass “One” has a variable named “variable1” and so does its subclass “Two”. Subclass “Two” overwrites One’s data for variable1. When a subclass changes the superclass’ data, this is called <strong>polymorphism.</strong></p><pre>class One:<br>    variable1 = 2<br><br>class Two(One):<br>    variable1 = 3<br><br>retrieve_data = Two()<br>print(One.variable1)<br>print(Two.variable1)</pre><h3>Super Classes and Sub Classes</h3><p>The examples shown above had functions within classes. There is also a way to make another class inherit the properties of the original class. The original class is referred to as the super class and the class that inherits its properties is the sub class. Below shows the syntax for a super and sub class:</p><pre># The Super Class<br>class First_Class():<br>    pass<br><br># The Sub Class. In parenthesis, write the name of the superclass <br># to inherit its attributes<br>class Second_Class(First_Class):<br>    pass</pre><h3>A Further Look How to Use Inheritance</h3><p>An example where a class has some properties that will be inherited by its subclass is shown below.</p><p>First, make a super class with a variable:</p><pre>class Insert_Superclassname:<br>    def __init__(self, variable1):<br>        self.variable1 = variable1</pre><p>Then, create another function called “def __str__(self):” that returns the variable which contains a string (4)</p><pre>class Insert_Superclassname:<br>    def __init__(self, variable1):<br>        self.variable1 = variable1<br><br>    def __str__(self):<br>        return self.variable1</pre><p><strong>An important note is the function “def __str__(self):” must be written as is to return the string.</strong></p><p>Create a subclass that will inherit the superclass. In the subclass under the constructor, write the name of the subclass followed by a dot and then make a constructor:</p><pre>class Insert_Superclassname:<br>    def __init__(self, variable1):<br>        self.variable1 = variable1<br><br>    def __str__(self):<br>        return self.variable1<br><br>class Insert_Subclassname(Insert_Superclassname):<br>    def __init__(self, variable1):<br>        Insert_Superclassname.__init__(self, variable1)</pre><p>This is the proper methodology of how to inherit from the superclass. To print the content of the class, declare a variable outside the class.</p><pre>class Insert_Superclassname:<br>    def __init__(self, variable1):<br>        self.variable1 = variable1<br><br>    def __str__(self):<br>        return self.variable1<br><br>class Insert_Subclassname(Insert_Superclassname):<br>    def __init__(self, variable1):<br>        Insert_Superclassname.__init__(self, variable1)<br><br>instance_var = Insert_Subclassname(&quot;Sample text&quot;)<br>print(instance_var)</pre><h3>Using super(). for Inheritance</h3><p>Instead of writing out the actual name of the superclass for the subclass to read it, the keyword “super().” can be used rather than writing out the superclass name and the word self instead (5).</p><pre>class Insert_Superclassname:<br>    def __init__(self, variable1):<br>        self.variable1 = variable1<br><br>    def __str__(self):<br>        return self.variable1<br><br>class Insert_Subclassname(Insert_Superclassname):<br>    def __init__(self, variable1):<br>        super().__init__(variable1)<br><br>superclass_instance_var = Insert_Superclassname(&quot;Sample text&quot;)<br>print(superclass_instance_var)<br><br>subclass_instance_var = Insert_Subclassname(&quot;More sample text&quot;)<br>print(subclass_instance_var)</pre><p>Notice the constructor in the subclass includes the self and the same variable as the superclass. The next line shows the “super().” line that includes the variables that are already declared. The “super().” line inherits the variables that are already declared. The “super().” line inherits the variables from the superclass where if it is further overridden by the subclass, the variable values in the superclass and subclass would be different. An error would not occur because of “super().”.</p><h3>Definitions</h3><p>Object-Oriented Programming — Is the use of objects with classes</p><p>Object — A variable that holds data</p><p>Classes — Used to create objects, and are an efficient way to access attributes through methods</p><p>Class Variables — A variable declared in the class and outside any of the class functions or constructor is called a class variable.</p><p>Instantiate — A variable that is created to make an object. Usually, most objects are declared or instantiated in OOP outside the class to retrieve the content from the class by using methods.</p><p>Methods — A dot command that uses a “.” to access class variables, instance variables or function variables within a class</p><p>Attributes — Qualities or variables that are defined in the class function or constructor parameters</p><p>Instances — A variable that is declared within the class’s function or constructor</p><p>Encapsulation — Private data that has less restrictions to be accessed through class methods</p><p>Superclass — A class that is declared to hold objects</p><p>Subclass — A class when created, can be written to inherit the properties of another class or the superclass.</p><p>Polymorphism — When a subclass overwrites data received from the superclass</p><h3>Sources</h3><p><a href="https://docs.python.org/3/tutorial/classes.html">https://docs.python.org/3/tutorial/classes.html</a> (1)</p><p><a href="https://www.geeksforgeeks.org/constructors-in-python/#">https://www.geeksforgeeks.org/constructors-in-python/#</a> (2)</p><p><a href="https://www.w3schools.com/python/gloss_python_self.asp">https://www.w3schools.com/python/gloss_python_self.asp</a> (3)</p><p><a href="https://edube.org/study/pe2">https://edube.org/study/pe2</a> (4)</p><p><a href="https://www.w3schools.com/python/ref_func_super.asp">https://www.w3schools.com/python/ref_func_super.asp</a> (5)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2b24792e115" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Start Using Git for Beginners]]></title>
            <link>https://medium.com/@andrewdass/how-to-start-using-git-for-beginners-dca1243d72b3?source=rss-e8132488d19b------2</link>
            <guid isPermaLink="false">https://medium.com/p/dca1243d72b3</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Andrew Dass]]></dc:creator>
            <pubDate>Fri, 27 Dec 2024 13:55:01 GMT</pubDate>
            <atom:updated>2024-12-27T13:55:01.051Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j0Qe2Qp6ZsSC2u9uSwb3EA.png" /></figure><h3>Overview</h3><p>This article will explain how to use a few commands to get started using Git in the terminal. Those commands are:</p><ul><li>git init</li><li>git add</li><li>git commit</li><li>git branch</li><li>git checkout</li><li>git remote</li><li>git push</li><li>git pull</li></ul><h3>Materials</h3><ul><li>Computer</li><li>Git (1)</li><li>GitHub and have a GitHub account (2)</li><li>Terminal or Powershell or Command Prompt</li></ul><h3>Downloading Git and Making a GitHub Account</h3><p>Git is a version control software that makes it easier to store files in a repository and also add, delete, update or revert file changes in the repository with Git commands. The repository can be accessed through the terminal or on their GitHub website. To download Git, visit their official website and download the right installation files for your operating system (1). GitHub is the website where there is a more friendly user interface that can also help interact with the repository that way. Visit the GitHub website to make an account and make repositories (2). After making a repository on the GitHub website, a GitHub URL is made with the repository.</p><h3>Make a Repository in GitHub</h3><ul><li>When making a repository in GitHub, log in into your account and click the “New” button</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*wsUyjIGYW7LNvHUyw1-dXA.png" /></figure><ul><li>Another way to make a repository from the home page, is in the top corner after you can click your profile picture, click “Your Repositories” from the drop-down menu.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*YCesnldEyx4fuuOQcaBc-A.png" /></figure><ul><li>After clicking “Your Repositories”, click the “New” button.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*md4cQmuTQG83kcg_VQsEYg.png" /></figure><ul><li>After clicking “New”, fill out the information in order to make a new repository.</li><li>Under “Repository name”, you must give every new repository a unique name and its name cannot be shared with another repository.</li><li>The repository can be selected as “Public” which allows other people to view it or “Private” which makes only the creator or you to view the repository</li><li>It is recommended to “Add a README file”. This file has a “.md” extension and a description can be written and displayed for the repository. However, when an empty repository is made or if the repository has no files, it shows instructions how to add files to the repository.</li><li>Once done, click the “Create Repository” button to make the repository</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2pXC0FjSD53meyoHJwdTFg.png" /></figure><ul><li>Once again, an empty repository shows instructions how to add files to the repository</li><li>After taking notes of these commands, it is recommended that every repository has a “README.md” file, and this file can be created from GitHub or from the terminal.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jz-giUs6K1vGVeGCIfcvSg.png" /></figure><h3>Terminal Commands</h3><p>In the terminal, change directory to a specified directory, preferably an empty or new directory on your computer and then run “git init”. “git init” initializes a git directory (3) to run git commands in order to download files from the git repository or upload files to the git repository.</p><pre>git init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pxfvo3b5oi4bctim-NV2RA.png" /></figure><p>Next, it is time to add a file to git. To make a file in the Terminal, use either the “touch” or “nano” to make a new file, write a few sentences and then save it afterwards with CTRL + S. To download nano on Windows, first install the chocolatey package (4) and then use the chocolatey package to download nano (5). Don’t forget to include its extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*SWD5iJHnM77f5pXtx-hDXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YdNx926toBdSwFKxHbm1hQ.png" /></figure><p>If there is a file already in your directory, then proceed by running the next git command: “git add README.md”. This command adds every specified file after “git add” from the desktop directory onto the git directory. Specifying files are also case-sensitive. The command “git add .” makes sure to add every file from the desktop directory to the git directory, since the “.” adds every file.</p><pre>git add README.md</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*ONaoGfLATfcZMSFxG_gn2Q.png" /></figure><p>Next, is to write a message when uploading files onto the git repository. The command “git commit -m …” allows to write a message, which is useful to explain changes in certain times of the repository.</p><pre>git commit -m &quot;Message&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mjojcH7Wli9_OrVc6RgEFA.png" /></figure><p>Press “Enter” after writing the commit command to see what changes, or in this case, which files or insertions will occur.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*spUGf_95-SCQm3dnDLB3FA.png" /></figure><p>Usually, when a Git repository is made, there is a main branch. If files are wanted to be added onto the main branch or another named branch, first create the branch in the Terminal with “git branch -M …”, where … is the name of the branch.</p><pre>git branch -M &quot;name_of_branch&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*c3JIBeNQZczjM4VbEy0A4A.png" /></figure><p>There can be more than one branch in a repository. To switch from one branch to another branch, use git checkout …, where … is the name of the branch again.</p><pre>git checkout &quot;name of branch&quot;</pre><p>Specify, where the files will be uploaded to with the “git remote add origin …” command, where is the HTTPS URL of the repository, which can be found on GitHub. If there are any files already in the repository, the layout will be different to find the HTTPS URL. Click the green “Code” button and the HTTPS URL will be there to copy from.</p><pre>git remote add origin &quot;Repository HTTPS URL&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yCFU_oOAA-Iml-1AjHT_LQ.png" /></figure><p>Lastly, to upload the “README.md” file onto the Git repository, use “git push -u origin …”, where … is the name of the branch</p><pre>git push -u origin &quot;name of branch&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qlKYHsF1-kmvr-FoxiqHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uveo9qAwsY-rMtZOyc6rPQ.png" /></figure><p>To retrieve data from any branch and edit it onto your computer, use the command “git pull origin …”, where … is the name of the branch</p><pre>git pull origin &quot;name_of_branch&quot;</pre><h3>Sources</h3><p><a href="https://git-scm.com/">https://git-scm.com/</a> (1)</p><p><a href="https://github.com/">https://github.com/</a> (2)</p><p><a href="https://git-scm.com/docs/git-init">https://git-scm.com/docs/git-init</a> (3)</p><p><a href="https://chocolatey.org/install">https://chocolatey.org/install</a> (4)</p><p><a href="https://community.chocolatey.org/packages/nano">https://community.chocolatey.org/packages/nano</a> (5)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dca1243d72b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create a Pythagorean Theorem Calculator in JavaScript]]></title>
            <link>https://medium.com/@andrewdass/how-to-create-a-pythagorean-theorem-calculator-in-javascript-44566a32ae2c?source=rss-e8132488d19b------2</link>
            <guid isPermaLink="false">https://medium.com/p/44566a32ae2c</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Andrew Dass]]></dc:creator>
            <pubDate>Mon, 23 Dec 2024 13:06:34 GMT</pubDate>
            <atom:updated>2024-12-23T13:06:34.596Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*en8-Sc1_-EhMB04Aoicy4Q.png" /></figure><h3>Overview</h3><p>This article will explain how to create a Pythagorean Theorem Calculator in JavaScript. This calculator either asks for:</p><ul><li>Two sides to calculate the Hypotenuse and the angles</li><li>One side and the Hypotenuse to calculate the missing side and angles</li><li>One side and one angle to calculate the missing side, Hypotenuse and the missing angle</li><li>One side and the Hypotenuse to calculate the missing side and angles</li></ul><h3>Materials</h3><ul><li>Computer</li><li>IDE or Text Editor</li></ul><h3>What is Pythagorean Theorem</h3><p>The Pythagorean Theorem (1) is when a right triangle’s two sides equal the diagonal side or the Hypotenuse using this formula:</p><pre>a^2 + b^2 = c^2</pre><p>where a and b are the two sides, and c is the hypotenuse</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*dPY3Gvp7xMaZRBhN-rbsdw.png" /></figure><p>A right triangle has three angles since each of the three sides intersect with one another at three different points, and one angle is always a right angle or 90 degrees. The other two angles, alpha and beta always sum up to 90 degrees, and the three angles together always sums up to 180 degrees. The angles can be found using trigonometry or the trigonometric identities (2).</p><h3>Procedure</h3><h4>How to make the Homepage.html</h4><p>To create the app, a homepage is needed. The file for the homepage in this tutorial is called “homepage.html”.</p><p>The homepage consists of the title, some text, a picture of a right triangle and more text and options to select what has been given to solve either the missing sides or angles.</p><p>Every html page should have the following format:</p><pre>&lt;html&gt;<br>    &lt;title&gt; &lt;/title&gt;<br><br>    &lt;head&gt;<br>        <br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        <br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>First, insert the words “Pythagorean Theorem Calculator” as the title between the title tags. When the application is open, the title of the tab in the internet browser should now say “Pythagorean Theorem Calculator”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*jCObMuLHn9sRrRBiLgGvsA.png" /></figure><p>The tutorial uses inline CSS, and all the CSS is written in the style tags which are within the head tags. The background color of the entire document can be changed by modifying the color of the body tag.</p><pre>&lt;html&gt;<br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt;<br>        &lt;style&gt; <br>            body {<br>                background-color: tan;<br>            }<br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        <br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>Next, the title on the webpage and a description explaining what the Pythagorean Theorem is, will be written on the webpage. The title is “Welcome to the Pythagorean Theorem Calculator!” and is placed within the &lt;title&gt; tags. The following italicized text below is placed within &lt;p&gt; tags</p><p><strong>Text in &lt;p&gt; tag:</strong></p><p><em>The Pythagorean Theorem is when a is when a right triangle’s two sides equal the diagonal side by using the format a² + b² = c². a and b are two sides that equal c or the diagonal side. By knowing two values of a right triangle, the missing side can be calculated using this formula.</em></p><p><em>A right triangle can also have one of the three sides be given with one angle. Every triangle has three sides, where each of the lines intersects and makes a point where an angle is created. Since it is a right triangle, one angle is always 90 degrees and the other two angles sum up to 90 degrees since, every triangle’s angles sum to 180 degrees. The trigonometric identities sin, cos, tan or csc, sec or cot can be used to find the missing sides or values.</em></p><p>For the inline CSS, h1 and p tags color and font-family were changed to green and Arial, Helvetica, sans-serif respectively. The title and description were also centered using &lt;center&gt; tags.</p><pre>&lt;html&gt;<br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt;<br>        &lt;style&gt; <br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            p {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt; &lt;h1&gt;Welcome to the Pythagorean Theorem Calculator! &lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt; <br>            &lt;p&gt; The Pythagorean Theorem is when a right triangle&#39;s two sides equal the diagonal side by using the format a&lt;sup&gt;2&lt;/sup&gt; + b&lt;sup&gt;2&lt;/sup&gt; = c&lt;sup&gt;2&lt;/sup&gt;. a and b are the two sides that equal c or the diagonal side. By knowing two values of a right triangle, the missing side can be calculated using this formula.<br>        &lt;br&gt;<br>        &lt;br&gt;<br>                A right triangle can also have one of the three sides be given with one angle. Every triangle has three sides, where each of the lines intersects and makes a point where an angle is created. Since it is a right triangle, one angle is always 90 degrees and the other two angles sum up to be 90 degrees since, every triangle&#39;s angles sum to 180 degrees. The trigonometric identities sin, cos, tan or csc, sec or cot can be used to find the missing sides or angles.  <br>    <br>            &lt;/p&gt; &lt;/center&gt;        <br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>Next an image of a right triangle is inserted into the webpage. The image was made in “Paint” with the same color background. A new class called container is created and within the tag, the image is inserted within it by using img src. Within the class and below inserting the image, more classes are made to write the text and angles that are displayed on the triangle. Within the inline CSS, the margins are specified and the text position as absolute for the text to be displayed correctly on the right triangle when the window is minimized or maximized. The inner classes use the original class as a reference where its positioning should be.</p><pre>&lt;html&gt;<br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt;<br>        &lt;style&gt; <br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            p {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt; &lt;h1&gt;Welcome to the Pythagorean Theorem Calculator! &lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt; <br>            &lt;p&gt; The Pythagorean Theorem is when a right triangle&#39;s two sides equal the diagonal side by using the format a&lt;sup&gt;2&lt;/sup&gt; + b&lt;sup&gt;2&lt;/sup&gt; = c&lt;sup&gt;2&lt;/sup&gt;. a and b are the two sides that equal c or the diagonal side. By knowing two values of a right triangle, the missing side can be calculated using this formula.<br>        &lt;br&gt;<br>        &lt;br&gt;<br>                A right triangle can also have one of the three sides be given with one angle. Every triangle has three sides, where each of the lines intersects and makes a point where an angle is created. Since it is a right triangle, one angle is always 90 degrees and the other two angles sum up to be 90 degrees since, every triangle&#39;s angles sum to 180 degrees. The trigonometric identities sin, cos, tan or csc, sec or cot can be used to find the missing sides or angles.  <br>    <br>            &lt;/p&gt; &lt;/center&gt;<br><br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br>                <br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>Next, a form with more text is inserted to choose an option for the user to pick from depending on what they have given for to solve the Pythagorean Theorem. In-line JavaScript code is also added to make the form fully functional.</p><p>A form is declared by specifying the id, action, and method. The id name is used identify which form is being changed if more than one form is in the document. If an option is chosen from the form, it redirects to another page by using action. Since this form has many options to choose from, the JavaScript code implements if and else statements to see which option is chosen from the form and redirects it to a certain webpage afterwards by respecifying the action. The method is set to GET as that is used to retrieve the information from the JavaScript code and send it back and update the HTML code.</p><p>In the JavaScript code, a function is used to implement all the if and else statements. Within the if and else statements, the “document.getElementById(‘’).checked” is used to see if which option and its specific id is checked or selected from the form. Then the document.getElementById(“the_form”).action will update the action to the correct webpage.</p><p>The button on the homepage is designed with some CSS and connected to the same function that uses if and else statements, which after being clicked, redirects to another webpage when a choice is chosen from the form.</p><pre>&lt;html&gt;<br>    &lt;title&gt; Pythagorean Theorem Calculator&lt;/title&gt;<br><br>    &lt;head&gt;<br>        &lt;style&gt;<br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            p {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            h2 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #the_form {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br><br>        &lt;/style&gt;<br><br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt; &lt;h1&gt;Welcome to the Pythagorean Theorem Calculator! &lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt; <br>            &lt;p&gt; The Pythagorean Theorem is when a right triangle&#39;s two sides equal the diagonal side by using the format a&lt;sup&gt;2&lt;/sup&gt; + b&lt;sup&gt;2&lt;/sup&gt; = c&lt;sup&gt;2&lt;/sup&gt;. a and b are the two sides that equal c or the diagonal side. By knowing two values of a right triangle, the missing side can be calculated using this formula.<br>        &lt;br&gt;<br>        &lt;br&gt;<br>                A right triangle can also have one of the three sides be given with one angle. Every triangle has three sides, where each of the lines intersects and makes a point where an angle is created. Since it is a right triangle, one angle is always 90 degrees and the other two angles sum up to be 90 degrees since, every triangle&#39;s angles sum to 180 degrees. The trigonometric identities sin, cos, tan or csc, sec or cot can be used to find the missing sides or angles.  <br>    <br>            &lt;/p&gt; &lt;/center&gt;<br><br><br> <br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br><br>        &lt;br&gt;<br>        &lt;br&gt;<br>        &lt;br&gt;<br><br>        &lt;center&gt; &lt;h2&gt; Select One of the Options Below: &lt;/h2&gt; &lt;/center&gt;<br><br>        &lt;center&gt; <br>        <br>            &lt;form id=&quot;the_form&quot; action=&quot;.html&quot; method=&quot;GET&quot;&gt;<br><br>                &lt;input type=&quot;radio&quot; id=&quot;side1_side2&quot; name=&quot;which_option&quot; value=&quot;Side 1 and Side 2&quot;&gt;<br>                &lt;label for=&quot;side1_side2&quot;&gt; Side 1 and Side 2 &lt;/label&gt;<br><br>                &lt;br&gt;<br>                <br>                &lt;input type=&quot;radio&quot; id=&quot;side1_hypotenuse&quot; name=&quot;which_option&quot; value=&quot;Side 1 and Hypotenuse&quot;&gt;<br>                &lt;label for=&quot;side1_hypotenuse&quot;&gt; Side 1 and Hypotenuse &lt;/label&gt;<br><br>                &lt;br&gt;<br><br>                &lt;input type=&quot;radio&quot; id=&quot;side2_hypotenuse&quot; name=&quot;which_option&quot; value=&quot;Side 2 and Hypotenuse&quot;&gt;<br>                &lt;label for=&quot;side2_hypotenuse&quot;&gt; Side 2 and Hypotenuse &lt;/label&gt;<br><br>                &lt;br&gt;<br><br>                &lt;input type=&quot;radio&quot; id=&quot;side1_α&quot; name=&quot;which_option&quot; value=&quot;Side 1 and α&quot;&gt;<br>                &lt;label for=&quot;side1_α&quot;&gt; Side 1 and α &lt;/label&gt;<br><br>                &lt;br&gt;<br><br>                &lt;input type=&quot;radio&quot; id=&quot;side2_α&quot; name=&quot;which_option&quot; value=&quot;Side 2 and α&quot;&gt;<br>                &lt;label for=&quot;side2_α&quot;&gt; Side 2 and α &lt;/label&gt;<br><br>                &lt;br&gt;<br><br>                &lt;input type=&quot;radio&quot; id=&quot;hypotenuse_α&quot; name=&quot;which_option&quot; value=&quot;Hypotenuse and α&quot;&gt;<br>                &lt;label for=&quot;hypotenuse_α&quot;&gt; Hypotenuse and α &lt;/label&gt;<br><br>                &lt;br&gt;<br><br>                &lt;input type=&quot;radio&quot; id=&quot;side1_β&quot; name=&quot;which_option&quot; value=&quot;Side 1 and β&quot;&gt;<br>                &lt;label for=&quot;side1_β&quot;&gt; Side 1 and β &lt;/label&gt;<br><br>                &lt;br&gt;<br><br>                &lt;input type=&quot;radio&quot; id=&quot;side2_β&quot; name=&quot;which_option&quot; value=&quot;Side 2 and β&quot;&gt;<br>                &lt;label for=&quot;side2_β&quot;&gt; Side 2 and β &lt;/label&gt;<br><br>                &lt;br&gt;<br><br>                &lt;input type=&quot;radio&quot; id=&quot;hypotenuse_β&quot; name=&quot;which_option&quot; value=&quot;Hypotenuse and β&quot;&gt;<br>                &lt;label for=&quot;hypotenuse_β&quot;&gt; Hypotenuse and β &lt;/label&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;button onclick=&quot;which_page()&quot; id=&quot;homepage_button&quot;&gt;Next&lt;/button&gt;<br><br>                <br>            &lt;/form&gt;<br><br>        &lt;/center&gt;<br><br>        <br>    &lt;/body&gt;<br><br>    &lt;script&gt;<br>        function which_page() {<br>            if(document.getElementById(&#39;side1_side2&#39;).checked) {<br>                document.getElementById(&quot;the_form&quot;).action = &quot;enter_side1_side2.html&quot;;<br>            }<br>            else if(document.getElementById(&#39;side1_hypotenuse&#39;).checked) {<br>                document.getElementById(&quot;the_form&quot;).action = &quot;enter_side1_hypo.html&quot;;<br>            }<br>            else if(document.getElementById(&#39;side2_hypotenuse&#39;).checked) {<br>                document.getElementById(&quot;the_form&quot;).action = &quot;enter_side2_hypo.html&quot;;<br>            }<br>            else if(document.getElementById(&#39;side1_α&#39;).checked) {<br>                document.getElementById(&quot;the_form&quot;).action = &quot;enter_side1_α.html&quot;;<br>            }<br>            else if(document.getElementById(&#39;side2_α&#39;).checked) {<br>                document.getElementById(&quot;the_form&quot;).action = &quot;enter_side2_α.html&quot;;<br>            }<br>            else if(document.getElementById(&#39;hypotenuse_α&#39;).checked) {<br>                document.getElementById(&quot;the_form&quot;).action = &quot;enter_hypo_α.html&quot;;<br>            }<br>            else if(document.getElementById(&#39;side1_β&#39;).checked) {<br>                document.getElementById(&#39;the_form&#39;).action = &quot;enter_side1_β.html&quot;;<br>            }<br>            else if(document.getElementById(&#39;side2_β&#39;).checked) {<br>                document.getElementById(&#39;the_form&#39;).action = &quot;enter_side2_β.html&quot;;<br>            }<br>            else if(document.getElementById(&#39;hypotenuse_β&#39;).checked) {<br>                document.getElementById(&#39;the_form&#39;).action = &quot;enter_hypo_β.html&quot;<br>            }<br>        }<br>    &lt;/script&gt;<br>&lt;/html&gt;</pre><h4>How to start creating the Form Pages</h4><p>Any option that is chosen from the form, displays the HTML file that contains a title, the picture of the right triangle, two text boxes to enter the values of what is being asked for, a calculate button and another button to return to the homepage.</p><p>As stated, every html page is recommended to start with this structure:</p><pre>&lt;html&gt;<br>    &lt;title&gt; &lt;/title&gt;<br><br>    &lt;head&gt;<br>        <br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        <br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>The title of the tab, on any page of this application is called, Pythagorean Theorem Calculator. Insert the words “Pythagorean Theorem Calculator” between the title tags.</p><pre>&lt;html&gt;<br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt;<br>        <br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        <br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>Next, is to change the background color of the webpage to tan. That can be done by inserting a style tag between the &lt;head&gt; tags. Within the style tag, the body background color can be edited to tan to change the document’s color.</p><pre>&lt;html&gt;<br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt;<br>        &lt;style&gt;<br>            body {<br>                background-color: tan;    <br>            }<br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        <br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>Next, the title on the webpage must be inserted. Within the body tags, h1 tags is inserted. Within this header, the words “Pythagorean Theorem Calculator” is written. Its style has also been edited for it to be green and the font is changed to Arial.</p><pre>&lt;html&gt;<br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt;<br>        &lt;style&gt;<br>            body {<br>                background-color: tan;    <br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt; &lt;h1&gt;Pythagorean Theorem Calculator&lt;/h1&gt; &lt;/center&gt;<br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>The image of the right triangle is now inserted similarly like the homepage. The styling code for the buttons were also inserted down below.</p><pre> &lt;html&gt;<br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt;<br>        &lt;style&gt;<br>            body {<br>                background-color: tan;    <br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            #the_form {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #next_page_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt; &lt;h1&gt;Pythagorean Theorem Calculator&lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><h4>Creating the Form on each HTML Webpage</h4><p>Every html page also has another header below the triangle image that specifies to enter the values into the two text boxes that are needed to complete the Pythagorean Theorem.</p><p>Below shows source code from the “enter_side1_side2.html” to explain the general process of how the forms were created in this application.</p><p>The form is created by specifying a form tag.</p><pre>&lt;html&gt;<br>    &lt;title&gt; &lt;/title&gt;<br><br>    &lt;head&gt;<br>        <br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                <br>            &lt;/form&gt;<br>        &lt;/center&gt;<br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>The form id is necessary and must be used in JavaScript to retrieve data from that particular form. The action specifies what webpage will appear next after the data is retrieved. “Method = GET” means some data is received from JavaScript and will be sent back to HTML. In this case, there will be JavaScript code that updates the action data, which will specify which webpage should be returned after receiving the data.</p><p>One textbox is created by using a &lt;label for&gt; tag. Two &lt;label for&gt; tags are used to make the text boxes.</p><pre> &lt;html&gt;<br>    &lt;title&gt; &lt;/title&gt;<br><br>    &lt;head&gt;<br>        <br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side1&quot;&gt; Side 1: &lt;/label&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;side2&quot;&gt; Side 2: &lt;/label&gt;<br>            &lt;/form&gt;<br>        &lt;/center&gt;<br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>The textbox can be specified to take a value of a certain data type. Textbox can take integers, if the input type is specified to take numbers. Every textbox can and should be given a name, for the JavaScript code to read the values. Its optional to specify a minimum or maximum value for each number. Every box’s minimum value that accepts a value for either the side or angle is 1. The maximum value for any angle box is 89.</p><pre>&lt;html&gt;<br>    &lt;title&gt; &lt;/title&gt;<br><br>    &lt;head&gt;<br>        <br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side1&quot;&gt; Side 1: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;side2&quot;&gt; Side 2: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot;&gt;<br>            &lt;/form&gt;<br>        &lt;/center&gt;<br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>For the HTML code to be compatible with JavaScript code, &lt;script&gt; tags are inserted in the HTML file where the JavaScript code can be written and read. All the JavaScript code is written into a function, and the function’s name can be read by making a button in HTML to read the code.</p><pre>&lt;html&gt;<br>    &lt;title&gt; &lt;/title&gt;<br><br>    &lt;head&gt;<br>        <br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side1&quot;&gt; Side 1: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;side2&quot;&gt; Side 2: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot;&gt;<br><br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;next_page_button&quot;&gt;Calculate&lt;/button&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>The button is declared to read a function that has the name “next_page()”, therefore, the function that is declared in JavaScript will be named “next_page()”.</p><p>Another button is also created in order to return to the homepage if the user wants to.</p><pre>&lt;html&gt;<br>    &lt;title&gt; &lt;/title&gt;<br><br>    &lt;head&gt;<br>        <br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side1&quot;&gt; Side 1: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;side2&quot;&gt; Side 2: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot;&gt;<br><br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;next_page_button&quot;&gt;Calculate&lt;/button&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function next_page() {<br>                var tri_side1 = document.forms[&quot;the_form&quot;][&quot;first_box&quot;].value;<br><br>                var tri_side2 = document.forms[&quot;the_form&quot;][&quot;second_box&quot;].value;<br><br>                var hypotenuse = Math.sqrt(tri_side1 * tri_side1 + tri_side2 * tri_side2);<br><br>                var angle_alpha = Math.atan(tri_side1 / tri_side2) * (180 / Math.PI);<br>                var angle_beta = Math.atan(tri_side2 / tri_side1) * (180 / Math.PI);<br>            }<br>        &lt;/script&gt;<br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>Here, new variables are declared in JavaScript to read the HTML form data by using “document.forms__.value”, where __ is a placeholder to insert the name of the form’s id and its label’s name. Each form has its own id, and every label or textbox has its own name. Both the id and name are needed to read each individual textbox value for “document.forms__.value” to work. By retrieving two values, either the sides or angles can be calculated by using the Pythagorean Theorem or trigonometric identities.</p><p>Depending what values were submitted for either the sides or angles, can result in an error or an illogical solution, therefore, if and else statements were implemented to forward to an error page if an incorrect result occurs. The code “localStorage.setItem()” is also used to send the calculated values onto the next directed webpage. The calculated values are displayed on the right triangle image. Another HTML button and &lt;script&gt; tags is inserted onto the page, if the user wants to return to the homepage. The buttons are styled by modifying the button’s id in the &lt;style&gt; tags.</p><pre>&lt;html&gt;<br>    &lt;title&gt; &lt;/title&gt;<br><br>    &lt;head&gt;<br>        <br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side1&quot;&gt; Side 1: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;side2&quot;&gt; Side 2: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot;&gt;<br><br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;next_page_button&quot;&gt;Calculate&lt;/button&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function next_page() {<br>                var tri_side1 = document.forms[&quot;the_form&quot;][&quot;first_box&quot;].value;<br><br>                var tri_side2 = document.forms[&quot;the_form&quot;][&quot;second_box&quot;].value;<br><br>                var hypotenuse = Math.sqrt(tri_side1 * tri_side1 + tri_side2 * tri_side2);<br><br>                var angle_alpha = Math.atan(tri_side1 / tri_side2) * (180 / Math.PI);<br>                var angle_beta = Math.atan(tri_side2 / tri_side1) * (180 / Math.PI);<br><br>                if ( tri_side1 == &quot;&quot; || tri_side1 == null || tri_side2 == &quot;&quot; || tri_side2 == null) {<br>                    alert(&quot;There are empty text boxes. Please submit two numbers.&quot;)<br>                }<br>                else {<br>                    document.getElementById(&quot;the_form&quot;).action = &quot;get_values.html&quot;;<br><br>                    localStorage.setItem(&#39;side1_value&#39;, tri_side1);<br>                    localStorage.setItem(&#39;side2_value&#39;, tri_side2);<br>                    localStorage.setItem(&#39;hypotenuse_value&#39;, hypotenuse);<br>                    localStorage.setItem(&#39;alpha_value&#39;, angle_alpha);<br>                    localStorage.setItem(&#39;beta_value&#39;, angle_beta);<br>                }<br>            }<br>        &lt;/script&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br><br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>Below is the complete source code for all the webpages:</p><h4>enter_side1_side2.html</h4><pre>&lt;html&gt;<br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt; <br>        &lt;style&gt;<br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            h2 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            #the_form {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #next_page_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt; <br>        &lt;center&gt; &lt;h1&gt;Pythagorean Theorem Calculator&lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br><br>        &lt;br&gt;<br>        &lt;br&gt;<br>        &lt;br&gt;<br>        <br>        &lt;center&gt; &lt;h2&gt;Enter Both Side Values Below:&lt;/h2&gt; &lt;/center&gt;<br>        <br>        <br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side1&quot;&gt; Side 1: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;side2&quot;&gt; Side 2: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot;&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>                <br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;next_page_button&quot;&gt;Calculate&lt;/button&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function next_page() {<br>                var tri_side1 = document.forms[&quot;the_form&quot;][&quot;first_box&quot;].value;<br><br>                var tri_side2 = document.forms[&quot;the_form&quot;][&quot;second_box&quot;].value;<br><br>                var hypotenuse = Math.sqrt(tri_side1 * tri_side1 + tri_side2 * tri_side2);<br><br>                var angle_alpha = Math.atan(tri_side1 / tri_side2) * (180 / Math.PI);<br>                var angle_beta = Math.atan(tri_side2 / tri_side1) * (180 / Math.PI);<br><br>                if ( tri_side1 == &quot;&quot; || tri_side1 == null || tri_side2 == &quot;&quot; || tri_side2 == null) {<br>                    alert(&quot;There are empty text boxes. Please submit two numbers.&quot;)<br>                }<br>                else {<br>                    document.getElementById(&quot;the_form&quot;).action = &quot;get_values.html&quot;;<br><br>                    localStorage.setItem(&#39;side1_value&#39;, tri_side1);<br>                    localStorage.setItem(&#39;side2_value&#39;, tri_side2);<br>                    localStorage.setItem(&#39;hypotenuse_value&#39;, hypotenuse);<br>                    localStorage.setItem(&#39;alpha_value&#39;, angle_alpha);<br>                    localStorage.setItem(&#39;beta_value&#39;, angle_beta);<br>                }<br>            }<br>        &lt;/script&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br><br><br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><h4>enter_side1_hypo.html</h4><pre>&lt;html&gt;<br><br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt; <br>        &lt;style&gt;<br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            h2 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            #the_form {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>            #calculate_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br><br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt; <br>        &lt;center&gt; &lt;h1&gt;Pythagorean Theorem Calculator&lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br><br>        &lt;br&gt;<br>        &lt;br&gt;<br>        &lt;br&gt;<br><br>        &lt;center&gt; &lt;h2&gt;Enter the Side and Hypotenuse Values below:&lt;/h2&gt; &lt;/center&gt;<br>        <br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side&quot;&gt; Side 1: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;hypotenuse&quot;&gt; Hypotenuse: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot;&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>                <br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;calculate_button&quot;&gt;Calculate&lt;/button&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function next_page() {<br>                var tri_side1 = document.forms[&quot;the_form&quot;][&quot;first_box&quot;].value;<br>                var hypotenuse = document.forms[&quot;the_form&quot;][&quot;second_box&quot;].value;<br><br>                var angle_alpha = Math.asin(tri_side1 / hypotenuse) * (180 / Math.PI);<br>                var angle_beta = Math.acos(tri_side1 / hypotenuse) * (180 / Math.PI);<br><br>                if ( tri_side1 == &quot;&quot; || tri_side1 == null || hypotenuse == &quot;&quot; || hypotenuse == null) {<br>                    alert(&quot;There are empty text boxes. Please submit two numbers.&quot;)<br>                }<br>                else {<br>                    if (Number(hypotenuse) &gt; Number(tri_side1)) {<br>                        var tri_side2 = Math.sqrt(hypotenuse * hypotenuse - tri_side1 * tri_side1);<br><br>                        document.getElementById(&quot;the_form&quot;).action = &quot;get_values.html&quot;;<br><br>                        localStorage.setItem(&#39;side1_value&#39;, tri_side1);<br>                        localStorage.setItem(&#39;side2_value&#39;, tri_side2);<br>                        localStorage.setItem(&#39;hypotenuse_value&#39;, hypotenuse);<br>                        localStorage.setItem(&#39;alpha_value&#39;, angle_alpha);<br>                        localStorage.setItem(&#39;beta_value&#39;, angle_beta);<br>                    }<br>                    else {<br>                        document.getElementById(&quot;the_form&quot;).action = &quot;not_valid_hypotenuse.html&quot;;<br><br>                    }<br>                }<br>            }<br>        &lt;/script&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br><br><br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><h4>enter_side2_hypo.html</h4><pre>&lt;html&gt;<br><br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt; <br>        &lt;style&gt;<br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            h2 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            #the_form {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>            #calculate_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br><br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt; <br>        &lt;center&gt; &lt;h1&gt;Pythagorean Theorem Calculator&lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br><br>        &lt;br&gt;<br>        &lt;br&gt;<br>        &lt;br&gt;<br><br>        &lt;center&gt; &lt;h2&gt;Enter the Side and Hypotenuse Values below:&lt;/h2&gt; &lt;/center&gt;<br>        <br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side&quot;&gt; Side 2: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;hypotenuse&quot;&gt; Hypotenuse: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot;&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>                <br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;calculate_button&quot;&gt;Calculate&lt;/button&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function next_page() {<br>                var tri_side2 = document.forms[&quot;the_form&quot;][&quot;first_box&quot;].value;<br><br>                var hypotenuse = document.forms[&quot;the_form&quot;][&quot;second_box&quot;].value;<br><br>                var angle_alpha = Math.acos(tri_side2 / hypotenuse) * (180 / Math.PI);<br>                var angle_beta = Math.asin(tri_side2 / hypotenuse) * (180 / Math.PI);<br><br>                if ( tri_side2 == &quot;&quot; || tri_side2 == null || hypotenuse == &quot;&quot; || hypotenuse == null) {<br>                    alert(&quot;There are empty text boxes. Please submit two numbers.&quot;)<br>                }<br>                else {<br>                    if (Number(hypotenuse) &gt; Number(tri_side2)) {<br>                        var tri_side1 = Math.sqrt(hypotenuse * hypotenuse - tri_side2 * tri_side2);<br><br>                        document.getElementById(&quot;the_form&quot;).action = &quot;get_values.html&quot;;<br><br>                        localStorage.setItem(&#39;side1_value&#39;, tri_side1);<br>                        localStorage.setItem(&#39;side2_value&#39;, tri_side2);<br>                        localStorage.setItem(&#39;hypotenuse_value&#39;, hypotenuse);<br>                        localStorage.setItem(&#39;alpha_value&#39;, angle_alpha);<br>                        localStorage.setItem(&#39;beta_value&#39;, angle_beta);<br>                    }<br>                    else {<br>                        document.getElementById(&quot;the_form&quot;).action = &quot;not_valid_hypotenuse.html&quot;;<br><br>                    }<br>                }<br>            }<br>        &lt;/script&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br><br><br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><h4>enter_side1_α.html</h4><pre>&lt;html&gt;<br><br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt; <br>        &lt;style&gt;<br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            h2 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            #the_form {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>            #calculate_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br><br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt; <br>        &lt;center&gt; &lt;h1&gt;Pythagorean Theorem Calculator&lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br><br>        &lt;br&gt;<br>        &lt;br&gt;<br>        &lt;br&gt;<br><br>        &lt;center&gt; &lt;h2&gt;Enter the Side and α Values below:&lt;/h2&gt; &lt;/center&gt;<br>        <br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side&quot;&gt; Side 1: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;α_angle&quot;&gt; α: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot; max=&quot;89&quot;&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>                <br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;calculate_button&quot;&gt;Calculate&lt;/button&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function next_page() {<br>                var tri_side1 = document.forms[&quot;the_form&quot;][&quot;first_box&quot;].value;<br>                var angle_alpha = document.forms[&quot;the_form&quot;][&quot;second_box&quot;].value;<br><br>                if ( tri_side1 == &quot;&quot; || tri_side1 == null || angle_alpha == &quot;&quot; || angle_alpha == null) {<br>                    alert(&quot;There are empty text boxes. Please submit two numbers.&quot;);<br>                }<br>                else {<br>                    var angle_beta = 90 - angle_alpha;<br>                    angle_beta_radians = angle_beta * Math.PI/180;<br>                    var tri_side2 = tri_side1 * Math.tan(angle_beta_radians);<br><br>                    var hypotenuse = Math.sqrt(tri_side1 * tri_side1 + tri_side2 * tri_side2);<br><br>                    document.getElementById(&quot;the_form&quot;).action = &quot;get_values.html&quot;;<br><br>                    localStorage.setItem(&#39;side1_value&#39;, tri_side1);<br>                    localStorage.setItem(&#39;side2_value&#39;, tri_side2);<br>                    localStorage.setItem(&#39;hypotenuse_value&#39;, hypotenuse);<br>                    localStorage.setItem(&#39;alpha_value&#39;, angle_alpha);<br>                    localStorage.setItem(&#39;beta_value&#39;, angle_beta);<br>                    <br>                }<br>            }<br>        &lt;/script&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br><br><br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><h4>enter_side2_α.html</h4><pre>&lt;html&gt;<br><br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt; <br>        &lt;style&gt;<br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            h2 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            #the_form {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>            #calculate_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br><br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt; <br>        &lt;center&gt; &lt;h1&gt;Pythagorean Theorem Calculator&lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br><br>        &lt;br&gt;<br>        &lt;br&gt;<br>        &lt;br&gt;<br><br>        &lt;center&gt; &lt;h2&gt;Enter the Side and α Values below:&lt;/h2&gt; &lt;/center&gt;<br>        <br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side&quot;&gt; Side 2: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;α_angle&quot;&gt; α: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot; max=&quot;89&quot;&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>                <br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;calculate_button&quot;&gt;Calculate&lt;/button&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function next_page() {<br>                var tri_side2 = document.forms[&quot;the_form&quot;][&quot;first_box&quot;].value;<br>                var angle_alpha = document.forms[&quot;the_form&quot;][&quot;second_box&quot;].value;<br><br>                if ( tri_side2 == &quot;&quot; || tri_side2 == null || angle_alpha == &quot;&quot; || angle_alpha == null) {<br>                    alert(&quot;There are empty text boxes. Please submit two numbers.&quot;);<br>                }<br>                else {<br>                    var angle_beta = 90 - angle_alpha;<br>                    angle_alpha_radians = angle_alpha * Math.PI/180;<br>                    var tri_side1 = tri_side2 * Math.tan(angle_alpha_radians);<br><br>                    var hypotenuse = Math.sqrt(tri_side1 * tri_side1 + tri_side2 * tri_side2);<br><br>                    document.getElementById(&quot;the_form&quot;).action = &quot;get_values.html&quot;;<br><br>                    localStorage.setItem(&#39;side1_value&#39;, tri_side1);<br>                    localStorage.setItem(&#39;side2_value&#39;, tri_side2);<br>                    localStorage.setItem(&#39;hypotenuse_value&#39;, hypotenuse);<br>                    localStorage.setItem(&#39;alpha_value&#39;, angle_alpha);<br>                    localStorage.setItem(&#39;beta_value&#39;, angle_beta);<br>                    <br>                }<br>            }<br>        &lt;/script&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br><br><br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><h4>enter_hypo_α.html</h4><pre>&lt;html&gt;<br><br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt; <br>        &lt;style&gt;<br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            h2 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            #the_form {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>            #calculate_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br><br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt; <br>        &lt;center&gt; &lt;h1&gt;Pythagorean Theorem Calculator&lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br><br>        &lt;br&gt;<br>        &lt;br&gt;<br>        &lt;br&gt;<br><br>        &lt;center&gt; &lt;h2&gt;Enter the Hypotenuse and α Values below:&lt;/h2&gt; &lt;/center&gt;<br>        <br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;hypotenuse&quot;&gt; Hypotenuse: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;α_angle&quot;&gt; α: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot; max=&quot;89&quot;&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>                <br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;calculate_button&quot;&gt;Calculate&lt;/button&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function next_page() <br>            {<br>                var hypotenuse = document.forms[&quot;the_form&quot;][&quot;first_box&quot;].value;<br>                var angle_alpha = document.forms[&quot;the_form&quot;][&quot;second_box&quot;].value;<br><br>                var angle_beta = 90 - angle_alpha;<br><br>                angle_alpha_radians = angle_alpha * Math.PI / 180;<br><br>                if ( hypotenuse == &quot;&quot; || hypotenuse == null || angle_alpha == &quot;&quot; || angle_alpha == null) <br>                {<br>                    alert(&quot;There are empty text boxes. Please submit two numbers.&quot;)<br>                }<br>                else <br>                    {<br>                        var tri_side1 = Math.sin(angle_alpha_radians) * hypotenuse;<br><br>                        var tri_side2 = Math.sqrt(hypotenuse * hypotenuse - tri_side1 * tri_side1);<br><br>                        document.getElementById(&quot;the_form&quot;).action = &quot;get_values.html&quot;;<br><br>                        localStorage.setItem(&#39;side1_value&#39;, tri_side1);<br>                        localStorage.setItem(&#39;side2_value&#39;, tri_side2);<br>                        localStorage.setItem(&#39;hypotenuse_value&#39;, hypotenuse);<br>                        localStorage.setItem(&#39;alpha_value&#39;, angle_alpha);<br>                        localStorage.setItem(&#39;beta_value&#39;, angle_beta);<br>                    }<br>            }<br>        &lt;/script&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br><br><br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><h4>enter_side1_β.html</h4><pre>&lt;html&gt;<br><br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt; <br>        &lt;style&gt;<br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            h2 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            #the_form {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>            #calculate_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br><br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt; <br>        &lt;center&gt; &lt;h1&gt;Pythagorean Theorem Calculator&lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br><br>        &lt;br&gt;<br>        &lt;br&gt;<br>        &lt;br&gt;<br><br>        &lt;center&gt; &lt;h2&gt;Enter the Side and β Values below:&lt;/h2&gt; &lt;/center&gt;<br>        <br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side&quot;&gt; Side 1: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;α_angle&quot;&gt; β: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot; max=&quot;89&quot;&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>                <br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;calculate_button&quot;&gt;Calculate&lt;/button&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function next_page() <br>            {<br>                var tri_side1 = document.forms[&quot;the_form&quot;][&quot;first_box&quot;].value;<br>                var angle_beta = document.forms[&quot;the_form&quot;][&quot;second_box&quot;].value;<br><br>                var angle_alpha = 90 - angle_beta;<br><br>                angle_beta_radians = angle_beta * Math.PI / 180;<br><br>                if ( tri_side1 == &quot;&quot; || tri_side1 == null || angle_beta == &quot;&quot; || angle_beta == null) <br>                {<br>                    alert(&quot;There are empty text boxes. Please submit two numbers.&quot;)<br>                }<br>                else <br>                    {<br>                        var tri_side2 = Math.tan(angle_beta_radians) * tri_side1;<br><br>                        var hypotenuse = Math.sqrt(tri_side1 * tri_side1 + tri_side2 * tri_side2);<br><br>                        document.getElementById(&quot;the_form&quot;).action = &quot;get_values.html&quot;;<br><br>                        localStorage.setItem(&#39;side1_value&#39;, tri_side1);<br>                        localStorage.setItem(&#39;side2_value&#39;, tri_side2);<br>                        localStorage.setItem(&#39;hypotenuse_value&#39;, hypotenuse);<br>                        localStorage.setItem(&#39;alpha_value&#39;, angle_alpha);<br>                        localStorage.setItem(&#39;beta_value&#39;, angle_beta);<br>                    }<br>            }<br>        &lt;/script&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br><br><br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><h4>enter_side2_β.html</h4><pre>&lt;html&gt;<br><br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt; <br>        &lt;style&gt;<br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            h2 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            #the_form {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>            #calculate_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br><br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt; <br>        &lt;center&gt; &lt;h1&gt;Pythagorean Theorem Calculator&lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br><br>        &lt;br&gt;<br>        &lt;br&gt;<br>        &lt;br&gt;<br><br>        &lt;center&gt; &lt;h2&gt;Enter the Side and β Values below:&lt;/h2&gt; &lt;/center&gt;<br>        <br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;side&quot;&gt; Side 2: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;β_angle&quot;&gt; β: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot; max=&quot;89&quot;&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>                <br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;calculate_button&quot;&gt;Calculate&lt;/button&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function next_page() <br>            {<br>                var tri_side2 = document.forms[&quot;the_form&quot;][&quot;first_box&quot;].value;<br>                var angle_beta = document.forms[&quot;the_form&quot;][&quot;second_box&quot;].value;<br><br>                var angle_alpha = 90 - angle_beta;<br><br>                angle_alpha_radians = angle_alpha * Math.PI / 180;<br><br>                if ( tri_side2 == &quot;&quot; || tri_side2 == null || angle_beta == &quot;&quot; || angle_beta == null) <br>                {<br>                    alert(&quot;There are empty text boxes. Please submit two numbers.&quot;)<br>                }<br>                else <br>                    {<br>                        var tri_side1 = Math.tan(angle_alpha_radians) * tri_side2;<br><br>                        var hypotenuse = Math.sqrt(tri_side1 * tri_side1 + tri_side2 * tri_side2);<br><br>                        document.getElementById(&quot;the_form&quot;).action = &quot;get_values.html&quot;;<br><br>                        localStorage.setItem(&#39;side1_value&#39;, tri_side1);<br>                        localStorage.setItem(&#39;side2_value&#39;, tri_side2);<br>                        localStorage.setItem(&#39;hypotenuse_value&#39;, hypotenuse);<br>                        localStorage.setItem(&#39;alpha_value&#39;, angle_alpha);<br>                        localStorage.setItem(&#39;beta_value&#39;, angle_beta);<br>                    }<br>            }<br>        &lt;/script&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br><br><br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><h4>enter_hypo_β.html</h4><pre>&lt;html&gt;<br><br>    &lt;title&gt; Pythagorean Theorem Calculator &lt;/title&gt;<br><br>    &lt;head&gt; <br>        &lt;style&gt;<br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            h2 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            .container {<br>                display: block;<br>                margin-left: auto;<br>                margin-right: auto;<br>                margin-top: auto;<br>                margin-bottom: auto;<br>                width: 50%;<br>            }<br><br>            .alpha_letter {<br>                position: absolute;<br>                margin-left: 105px;<br>                margin-top: -60px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .beta_letter {<br>                position: absolute;<br>                margin-left: -90px;<br>                margin-top: -307px;<br>                width: 50%;<br>                font-size: 18px;<br>                color: green;<br>            }<br><br>            .letter_a_and_side1 {<br>                position: absolute;<br>                margin-left: -170px;<br>                margin-top: -200px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br><br>            .letter_b_and_side2 {<br>                position: absolute;<br>                margin-left: 10px;<br>                margin-top: -10px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            <br>            .letter_c_and_hypotenuse {<br>                position: absolute;<br>                margin-left: 130px;<br>                margin-top: -220px;<br>                width: 50%;<br>                font-size: 24px;<br>                color: green;<br>            }<br><br>            #the_form {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br>            #calculate_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br><br><br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt; <br>        &lt;center&gt; &lt;h1&gt;Pythagorean Theorem Calculator&lt;/h1&gt; &lt;/center&gt;<br><br>        &lt;center&gt;<br>            &lt;div class=&quot;container&quot;&gt;<br>                &lt;img src=&quot;right_triangle.png&quot; width=&quot;350&quot; height=&quot;350&quot;&gt;<br>                &lt;div class=&quot;alpha_letter&quot;&gt;α&lt;/div&gt;<br>                &lt;div class=&quot;beta_letter&quot;&gt;β&lt;/div&gt;<br>                &lt;div class=&quot;letter_a_and_side1&quot;&gt; a &lt;br&gt; (Side 1) &lt;/div&gt;<br>                &lt;div class=&quot;letter_b_and_side2&quot;&gt; b &lt;br&gt; (Side 2) &lt;/div&gt;<br>                &lt;div class=&quot;letter_c_and_hypotenuse&quot;&gt; c &lt;br&gt; (Hypotenuse) &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/center&gt;<br><br>        &lt;br&gt;<br>        &lt;br&gt;<br>        &lt;br&gt;<br><br>        &lt;center&gt; &lt;h2&gt;Enter the Hypotenuse and β Values below:&lt;/h2&gt; &lt;/center&gt;<br>        <br>        &lt;center&gt;<br>            &lt;form id=&quot;the_form&quot; action=&quot;&quot; method=&quot;GET&quot;&gt;<br>                &lt;label for=&quot;hypotenuse&quot;&gt; Hypotenuse: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;first_box&quot; min=&quot;1&quot;&gt; <br><br>                &lt;br&gt;<br>                &lt;br&gt;<br><br>                &lt;label for=&quot;β_angle&quot;&gt; β: &lt;/label&gt;<br>                &lt;input type=&quot;number&quot; name=&quot;second_box&quot; min=&quot;1&quot; max=&quot;89&quot;&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>                <br>                &lt;button onclick=&quot;next_page()&quot; id=&quot;calculate_button&quot;&gt;Calculate&lt;/button&gt;<br><br>                &lt;br&gt;<br>                &lt;br&gt;<br>            &lt;/form&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function next_page() <br>            {<br>                var hypotenuse = document.forms[&quot;the_form&quot;][&quot;first_box&quot;].value;<br>                var angle_beta = document.forms[&quot;the_form&quot;][&quot;second_box&quot;].value;<br><br>                var angle_alpha = 90 - angle_beta;<br><br>                angle_beta_radians = angle_beta * Math.PI / 180;<br><br>                if ( hypotenuse == &quot;&quot; || hypotenuse == null || angle_beta == &quot;&quot; || angle_beta == null) <br>                {<br>                    alert(&quot;There are empty text boxes. Please submit two numbers.&quot;)<br>                }<br>                else <br>                    {<br>                        var tri_side1 = Math.cos(angle_beta_radians) * hypotenuse;<br>                        var tri_side2 = Math.sin(angle_beta_radians) * hypotenuse;<br><br>                        document.getElementById(&quot;the_form&quot;).action = &quot;get_values.html&quot;;<br><br>                        localStorage.setItem(&#39;side1_value&#39;, tri_side1);<br>                        localStorage.setItem(&#39;side2_value&#39;, tri_side2);<br>                        localStorage.setItem(&#39;hypotenuse_value&#39;, hypotenuse);<br>                        localStorage.setItem(&#39;alpha_value&#39;, angle_alpha);<br>                        localStorage.setItem(&#39;beta_value&#39;, angle_beta);<br>                    }<br>            }<br>        &lt;/script&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br><br>    &lt;/body&gt;<br><br>&lt;/html&gt;</pre><p>Below are webpages that can show up depending on the error:</p><h4>no_values_inputted.html</h4><pre>&lt;html&gt;<br>    &lt;title&gt;Pythagorean Theorem Calculator&lt;/title&gt;<br><br>    &lt;head&gt;<br><br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt;<br>            &lt;h1&gt; Pythagorean Theorem Calculator &lt;/h1&gt;<br>            &lt;p&gt; No values were inserted or there was an invalid input. &lt;/p&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br>    &lt;/body&gt;<br>&lt;/html&gt;</pre><h4>not_valid_hypotenuse.html</h4><pre>&lt;html&gt;<br>    &lt;title&gt;Pythagorean Theorem Calculator&lt;/title&gt;<br><br>    &lt;head&gt;<br>        &lt;style&gt;<br>            body {<br>                background-color: tan;<br>            }<br><br>            h1 {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            p {<br>                color: green;<br>                font-family: Arial, Helvetica, sans-serif;<br>            }<br><br>            #homepage_button {<br>                color: white;<br>                background-color: gray;<br>                padding: 8px 8px;<br>            }<br>        &lt;/style&gt;<br>    &lt;/head&gt;<br><br>    &lt;body&gt;<br>        &lt;center&gt;<br>            &lt;h1&gt; Pythagorean Theorem Calculator &lt;/h1&gt;<br>            &lt;p&gt; Invalid input. The hypotenuse value cannot be equal to or less than the triangle&#39;s two other sides. &lt;/p&gt;<br><br>            &lt;button onclick=&quot;return_to_homepage()&quot; id=&quot;homepage_button&quot;&gt;Return to Homepage&lt;/button&gt;<br>        &lt;/center&gt;<br><br>        &lt;script&gt;<br>            function return_to_homepage() {<br>                location.replace(&quot;homepage.html&quot;)<br>            }<br>        &lt;/script&gt;<br>    &lt;/body&gt;<br>&lt;/html&gt;</pre><h3>Sources</h3><p><a href="https://www.mathsisfun.com/pythagoras.html">https://www.mathsisfun.com/pythagoras.html</a> (1)</p><p><a href="https://www.mathsisfun.com/algebra/trigonometric-identities.html">https://www.mathsisfun.com/algebra/trigonometric-identities.html</a> (2)</p><h3>Source Code</h3><p><a href="https://github.com/AndrewDass1/PROJECTS/tree/main/Project%205%3A%20Pythagorean%20Theorem%20Calculator">https://github.com/AndrewDass1/PROJECTS/tree/main/Project%205%3A%20Pythagorean%20Theorem%20Calculator</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44566a32ae2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python: How to use Built-In List Methods and how to Create Them from Scratch]]></title>
            <link>https://medium.com/@andrewdass/python-how-to-use-built-in-list-methods-and-how-to-create-them-from-scratch-398f8c40647b?source=rss-e8132488d19b------2</link>
            <guid isPermaLink="false">https://medium.com/p/398f8c40647b</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[lists-in-python]]></category>
            <dc:creator><![CDATA[Andrew Dass]]></dc:creator>
            <pubDate>Fri, 13 Dec 2024 15:28:04 GMT</pubDate>
            <atom:updated>2024-12-13T15:34:21.456Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l_fLrcMZNhcznlw_VDGnyg.png" /></figure><h3>Overview</h3><p>This article will explain how to use Python’s built-in methods for Lists and also how to create them from scratch. Creating the built-in methods from scratch is beneficial for interviews, as some interviewers would like to see their interviewees code without relying on these techniques.</p><h3>Materials</h3><ul><li>Computer</li><li>Python</li><li>IDE</li></ul><h3>Declaring a List Data Type</h3><p>A list is created by declaring a variable that is equal to a pair of brackets that contain variables or numbers within the code.</p><h4>An Example of a List</h4><pre># Variable name on the left side and its equal<br># to a bracket []. Within the bracket contains variables,<br># numbers or other data structures in it.<br><br>make_a_list = [1,2,3]</pre><h3>List Built-in Methods</h3><p>Every method follows the same convention in Python, a dot or “.”, and after the dot is the name of the command and a (). An example of one command is called “.append()”. To use a command, enter the variable name of the list and then the convention and specific name of the command. In the parenthesis for each command, different inputs can be added.</p><h3>An Example of Using a List Command: Append</h3><p>The .append() method adds an element to the last index in a List</p><pre>make_a_list = [1,2,3]<br># Variable Name Followed by Method Name<br><br>make_a_list.append(5)<br><br>print(make_a_list)<br># Result:<br># [1, 2, 3, 5] </pre><h3>How to Replicate the Append Method</h3><pre>make_a_list = [1,2,3]<br><br># Below shows two ways how to add more variables to a list<br># without using .append()<br><br># First Way<br>make_a_list = make_a_list + [5]<br><br># or<br><br># Second Way<br>make_a_list += [5]<br><br>print(make_a_list)<br># Result:<br># [1, 2, 3, 5]</pre><p>Adding a new element to any list will be placed in the last index of the list.</p><h3>How to use the Extend Method</h3><p>The .extend() method combines two lists into one list. By printing the list variable that comes before the extend method, will show the other list variable was added to it.</p><pre>list_1 = [1, 2]<br>list_2 = [8, 9]<br><br>list_1.extend(list_2)<br><br>print(list_1)<br># Result:<br># [1, 2, 8, 9] </pre><h3>How to Replicate the Extend Method</h3><pre>list_1 = [1, 2]<br>list_2 = [8, 9]<br><br>list_1 = list_1 + list_2<br># or<br>list_1 += list_2<br><br>print(list_1)<br># Result:<br># [1, 2, 8, 9]</pre><h3>How to use the Insert Method</h3><p>The .insert() method adds an element at any index in the list. Within the parenthesis, the first parameter is the index where the element should be added to, and the second parameter is the element and its data type.</p><pre>list_1 = [1, 2, 3, 4]<br>list_1.insert(1, &quot;hello&quot;)<br><br>print(list_1)<br># Result:<br># [1, &#39;hello&#39;, 2, 3, 4]</pre><h3>How to Replicate the Insert Method</h3><p>The .insert() method can be replicated by slicing a list to different parts and adding it back together with the desired element.</p><pre>list_1 = list_1[0:1] + [&#39;hello&#39;] + list_1[1:]<br>print(list_1)<br><br># Result:<br># [1, &#39;hello&#39;, 2, 3, 4]</pre><p>Since this example shows the word ‘hello’ to be added to the first index of the new list_1. First list_1 is sliced up to index 1, then ‘hello’ is added to the list and the rest of the elements from list_1 is added by using another slice to modify list_1.</p><h3>How to use the Remove Method</h3><p>The .remove() method disposes of the first specified element that appears in the lowest positive index.</p><pre>list_1 = [1, 2, 3, 4, 2]<br>list_1.remove(2)<br>print(list_1)<br><br># Result:<br># [1, 3, 4, 2]</pre><h3>How to Replicate the Remove Method</h3><p>The .remove() method can be replicated by slicing the list into different pieces and adding it back together without the specific element.</p><pre>list_1 = list_1[0:1] + list_1[2:]<br>print(list_1)<br># Result:<br># [1, 3, 4, 2]</pre><h3>How to use the Pop Method</h3><p>The .pop() method takes a parameter for the index for which to remove that element from. If no parameter is specified, then the last element from the list is removed.</p><pre>list_1 = [1, 2, 3, 4, 2]<br>list_1.pop(3)<br>print(list_1)<br># Result:<br># [1, 2, 3, 2]</pre><h3>How to Replicate the Pop Method</h3><p>Just like the remove method, the pop method can be replicated by slicing the list into different pieces and adding it back together without the specific element.</p><h3>How to use the Clear Method</h3><p>The .clear() method makes the list variable into an empty list.</p><pre>list_1 = [1,2,3]<br>list_1.clear()<br>print(list_1)<br># Result:<br># []</pre><h3>How to Replicate the Clear Method</h3><p>To replicate the .clear() method, a variable can be reassigned to an empty list or a [], which indicates an empty list.</p><pre>list_1 = [1,2,3]<br>list_1 = []<br>print(list_1)<br># Result:<br># []</pre><h3>How to use the Index Method</h3><p>The .index() method accepts a parameter that can be of any data type, and the .index() method returns which index that element can be found at the lowest index.</p><pre>list_1 = [1,2,3,4,2]<br><br>print(list_1.index(2))<br># Result:<br># 1<br># In this case, the number 2 is searched for and is found at index 1</pre><h3>How to Replicate the Index Method</h3><p>To replicate the index method, a for loop can be used to iterate through the list and find, the specific element that is in the list.</p><pre># Declare the list<br>list_1 = [1, 2, 3, 4, 2]<br><br># Declare a variable that needs to be incremented<br># to check for the list elements. In this case, the<br># variable is index.<br>index = 0<br><br># Make a for loop, until it reaches the last element<br># of the list. in range(0, len(list_1)) makes it<br># the for loop iterate through the first index to<br># the last index because of len(list_1)<br><br># Add an if statement to see if the element is<br># present in the list. Also increment the declared<br># variable that needs to be increased.<br><br>for i in range(0, len(list_1)):<br>    if list_1[index] == 2:<br>        print(&quot;Match at index &quot; + str(index))<br>    index += 1</pre><h4>The Index Code without Comments</h4><pre>list_1 = [1, 2, 3, 4, 2]<br><br>index = 0<br><br>for i in range(0, len(list_1)):<br>    if list_1[index] == 2:<br>        print(&quot;Match at index &quot; + str(index))<br>    index += 1</pre><h3>How to use the Count Method</h3><p>The .count() method outputs how many times a certain element is in the list.</p><pre>list_1 = [1, 2, 9, 4, 9]<br>print(list_1.count(9))<br># Result:<br># 2</pre><h3>How to Replicate the Count Method</h3><p>The .count() method can be replicated by using a for-loop similarly as shown in the index method. Another variable has to be declared as a counter to keep track of, how many times a specific element has been found in the list.</p><pre>list_1 = [1, 2, 9, 4, 9]<br><br>index = 0<br>times_element_appeared = 0<br><br>for i in range(0, len(list_1)):<br>    if list_1[index] == 9:<br>        print(&quot;Match at index &quot; + str(index))<br>        times_element_appeared += 1<br>    index += 1<br><br># print(Times element appeared: &quot; + str(times_element_appeared))<br># Result:<br># Match at index 2<br># Match at index 4<br># Times element appeared: 2</pre><h3>How to use the Sort Method</h3><p>The .sort() method can be used to sort integers or string in ascending or descending order.</p><pre># Print in Ascending Order<br>words = [&quot;chicken&quot;, &quot;beef&quot;, &quot;pork&quot;, &quot;turkey&quot;]<br>words.sort()<br>print(words)<br><br># Result:<br># [&#39;beef&#39;, &#39;chicken&#39;, &#39;pork&#39;, &#39;turkey&#39;]</pre><pre># Print in Descending Order<br>words = [&quot;chicken&quot;, &quot;beef&quot;, &quot;pork&quot;, &quot;turkey&quot;]<br>words.sort(reverse=True)<br>print(words)<br><br># Result:<br># [&#39;turkey&#39;, &#39;pork&#39;, &#39;chicken&#39;, &#39;beef&#39;]</pre><h3>How to Replicate the Sort Method</h3><p>The .sort() method can be created by using a nested for loop and swapping integers or words in one line.</p><h4>Sorting integers or floats:</h4><pre>list_one = [1, 9.2, 9, 8, 15, 13.7]<br><br>for index_one in range(len(list_one)):<br>    for index_two in range(index_one + 1, len(list_one)):<br><br>        if list_one[index_one] &gt; list_one[index_two]:<br>           list_one[index_one], list_one[index_two] = list_one[index_two], list_one[index_one]<br><br>print(list_one)<br><br># Result:<br># [1, 8, 9, 9.2, 13.7, 15]</pre><pre>list_two = [&quot;pork&quot;, &quot;turkey&quot;, &quot;chicken&quot;, &quot;beef&quot;]<br><br>for index_one in range(len(list_two)):<br>    for index_two in range(index_one + 1, len(list_two)):<br><br>        if list_two[index_one] &gt; list_two[index_two]:<br>           list_two[index_one], list_two[index_two] = list_two[index_two], list_two[index_one]<br><br>print(list_two)<br><br># Result:<br># [&#39;beef&#39;, &#39;chicken&#39;, &#39;pork&#39;, &#39;turkey&#39;]</pre><h3>How to use the Reverse Method</h3><p>The .reverse() method reverses an entire list.</p><pre>list_1 = [1, 2, 9, 4, 7]<br>list_1.reverse()<br>print(list_1)<br># Result:<br># [7, 4, 9, 2, 1]</pre><h3>How to Replicate the Reverse Method</h3><p>A list can be printed reverse by slicing using [::-1]. The first two parameters do not have to be specified since it automatically will start from the largest index and decrease to the lowest index since the last parameter -1, will decrease to the lowest index.</p><pre>list_1 = [1, 2, 9, 4, 7]<br>print(list_1[::-1])<br># Result:<br># [7, 4, 9, 2, 1]</pre><h3>How to use the Copy Method</h3><p>The .copy() method makes another variable an exact copy of another created list.</p><pre>list_1 = [1, 2, 9, 4, 7]<br>list_2 = list_1.copy()<br>print(list_2)<br># Result:<br># [1, 2, 9, 4, 7]</pre><h3>How to Replicate the Copy Method</h3><p>The copy method can be replicated by assigning a new variable to equal an already created list.</p><pre>list_1 = [1, 2, 9, 4, 7]<br>list_2 = list_1<br>print(list_2)<br># Result:<br># [1, 2, 9, 4, 7]</pre><h3>Conclusion</h3><p>With a list, you can:</p><ul><li>Add elements</li><li>Extend or combine two lists into one</li><li>Insert an element at any index</li><li>Remove elements</li><li>Pop an element or remove an element from a certain index</li><li>Clear the entire list</li><li>Find the index where a certain variable or number is</li><li>Count how many times the same element appears in a list</li><li>Sort a list</li><li>Reverse all the elements in a list</li><li>Copy a list</li></ul><h3>Sources</h3><p><a href="https://docs.python.org/3/tutorial/datastructures.html">https://docs.python.org/3/tutorial/datastructures.html</a> (1)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=398f8c40647b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python: How to use the “pytest” Module]]></title>
            <link>https://medium.com/@andrewdass/python-how-to-use-the-pytest-module-6c6978962fea?source=rss-e8132488d19b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c6978962fea</guid>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[pytest]]></category>
            <dc:creator><![CDATA[Andrew Dass]]></dc:creator>
            <pubDate>Fri, 08 Mar 2024 21:44:29 GMT</pubDate>
            <atom:updated>2024-03-08T21:53:08.574Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m5vJ079NMG87HX7UNx2j5Q.png" /></figure><h3>Overview</h3><p>This article will explain how to use the “pytest” module in the Python programming language. “pytest” is used to detect whether statements are True or False by using the assert command (1).</p><h3>Materials</h3><ul><li>Python 3.6+ or PyPy3 (1)</li><li>Python modules: pytest, random</li><li>IDE or Terminal</li></ul><h3>Installing Pytest</h3><p>Run the command in the Terminal to download pytest if it is not installed (2):</p><pre>pip install -U pytest</pre><h3>Procedure</h3><ul><li>Create any Python script where the name of the file must begin with the word “test” and the function of the script has to start with the word “test” or the have the first four letters be “test”</li><li>In the function, have a statement be assessed with the assert keyword to validate if the statement is True or False</li><li>In the Terminal, type “pytest” to check the files</li></ul><pre>import random<br><br>def test_check_multiplication():<br>    a = random.randint(1, 2)<br>    b = random.randint(1, 2)<br>    c = random.randint(1, 4)<br>    assert a * b == c</pre><ul><li>If the file and function does not begin with “test”, then 0 items will be collected. As shown below, the name of the file begins with the word “testing” and not “test”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zZoeAZaW4bkC6lp5ldFVuQ.png" /></figure><ul><li>Items refer to the amount of files that was received in the directory where the “pytest” command is being ran in. “pytest” checks every Python file that begins with the name “test” and each of those files has a function that begins with “test” and contains an assert statement to check, otherwise 0 items will be collected.</li><li>Since this file utilizes the random module to generate random integers for a, b, and c and then sees if a * b == c, this file has to be ran a couple of times to see if the result is a success or the result is True</li></ul><h4>A Pytest Error</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CN-PhLJ09F_-B_fs3eUnwQ.png" /></figure><h4>A Pytest Success</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pWCXMg7ueNLCy0RjJU1KjQ.png" /></figure><h4>Printing the Statement in the Terminal</h4><ul><li>Instead of writing “pytest”, write “pytest -s” and include “print()” statements in the function to output the variable values in the Terminal</li></ul><pre>import random<br><br>def testing_check_multiplication():<br>    a = random.randint(1, 2)<br>    b = random.randint(1, 2)<br>    c = random.randint(1, 4)<br><br>    print(&quot;Variable a:&quot;, a)<br>    print(&quot;Variable b:&quot;, b)<br>    print(&quot;a * b:&quot;, a * b)<br>    print(&quot;Variable c:&quot;, c)<br><br>    assert a * b == c</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUPmu4i4N9s-hce8PnrCBw.png" /></figure><h3>Sources</h3><p><a href="https://docs.pytest.org/en/8.0.x/">https://docs.pytest.org/en/8.0.x/</a> (1)</p><p><a href="https://docs.pytest.org/en/6.2.x/getting-started.html">https://docs.pytest.org/en/6.2.x/getting-started.html</a> (2)</p><h3>Source Code</h3><p><a href="https://github.com/AndrewDass1/SCRIPTS/tree/main/Python/Pytest%20Scripts/Pytest%20and%20Random">https://github.com/AndrewDass1/SCRIPTS/tree/main/Python/Pytest%20Scripts/Pytest%20and%20Random</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c6978962fea" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>