My Blog

8/23/2023

%%HTML
<img src="/Student1/images/freeform.jpg" height="400" width="200" alt="freeform image">

<p> My freeform image starts with a large image of missouri, the state I was born in. 
    Within the state there is a star located at St. Louis, my birth city, and going away from the start
    there is an arrow showing that I moved away to california. I enjoy many things, some of which are
    represented in the picture. For example I enjoy relaxing and playing games, both of which are listed
    in the picture directly. Within these large 2 catagories are more specfic things I enjoy, like riding
    my bike and playing on my computer
</p>

freeform image

My freeform image starts with a large image of missouri, the state I was born in. Within the state there is a star located at St. Louis, my birth city, and going away from the start there is an arrow showing that I moved away to california. I enjoy many things, some of which are represented in the picture. For example I enjoy relaxing and playing games, both of which are listed in the picture directly. Within these large 2 catagories are more specfic things I enjoy, like riding my bike and playing on my computer

8/24/2023

Basic Python

string1 = "I Am A String"
string2 = "I Am One As Well"

combineString = string1+", "+string2
print(combineString)
I Am A String, I Am One As Well

Drawing a graph

import matplotlib.pyplot as plt
x = [1,2,3]
y = [2,4,1]

xf = []
yf = []

for i in range(101):
    x_1 = (1-(i/100))*x[0] + x[1]*(i/100)
    x_2 = (1-(i/100))*x[1] + x[2]*(i/100)
    x_3 = (1-(i/100))*x_1 + x_2*(i/100)
    xf.insert(i,x_3)

    y_1 = (1-(i/100))*y[0] + y[1]*(i/100)
    y_2 = (1-(i/100))*y[1] + y[2]*(i/100)
    y_3 = (1-(i/100))*y_1 + y_2*(i/100)
    yf.insert(i,y_3)

plt.plot(xf,yf)
plt.show()

png

%%HTML
    <p><b> This is what python would've shown</b></p>
    <img src="/Student1/images/output.png" alt = "graph">

This is what that wouldve shown

graph

8/28/2023

%%HTML

<button onclick="myFunction(1)"> 1  </button>
<button onclick="myFunction(2)"> 2  </button>
<button onclick="myFunction(3)"> 3  </button>
<button onclick="myFunction(4)"> 4  </button>
<button onclick="myFunction(5)"> 5  </button>
<button onclick="myFunction(6)"> 6  </button>
<button onclick="myFunction(7)"> 7  </button>
<button onclick="myFunction(8)"> 8  </button>
<button onclick="myFunction(9)"> 9  </button>
<button onclick="myFunction(0)"> 0  </button>
<button onclick="modif(1)"> + </button>
<button onclick="modif(2)"> - </button>
<button onclick="modif(3)"> x </button>
<button onclick="modif(4)"> ÷ </button>
<button onclick="equal()"> = </button>
<p id ="text"> 0</p>

<script> 
    let state = 0;
    let runningTotal = 0;
    const peices = [];
    const funcs = [];

    function equal() {
        peices[peices.length] = runningTotal
        let tempRun = peices[0];
        const temp = []; //values
        const temp2 = []; // operators
        
        for (let i = 0; i < funcs.length; i++) {
        
            if (funcs[i]==3){//multiplication
                tempRun = tempRun*peices[i+1];
                continue;
            }
            if (funcs[i]==4) { //divison
                tempRun = tempRun/peices[i+1];
                continue;
            }
            if (funcs[i]==1) { //addition
                temp[temp.length] = tempRun;               
                temp2[temp2.length] = 1;
                tempRun = peices[i+1];
                continue;
            }
            if (funcs[i]==2) { //subtraction
                temp[temp.length] = tempRun;
                temp2[temp2.length] = 2;
                tempRun = peices[i+1];
                continue;
            }
        }
        temp[temp.length] = tempRun;
        
        tempRun = temp[0];
        for (let i = 0; i < temp2.length; i++) {
            if (temp2[i]==1) {
                tempRun += temp[i+1];
            }
            else {
                tempRun -= temp[i+1];
            }
        }
        document.getElementById("text").innerText = "="+tempRun;
        runningTotal = tempRun;
        state = 1;
        funcs.length = 0;
        peices.length = 0;
        
    }

    function modif(a) {
        if (a==1){
    	document.getElementById("text").innerText += "+";
        }
        if (a==2){
    	document.getElementById("text").innerText += "-";
        }
        if (a==3){
    	document.getElementById("text").innerText += "x";
        }
        if (a==4){
    	document.getElementById("text").innerText += "÷";
        }

        peices[peices.length] = runningTotal;
        runningTotal = 0;
        funcs[funcs.length] = a;
        state = 0;
        
    }

    function myFunction(a) {
        if (state==1){
            runningTotal = 0;
            state = 0;
        }
        runningTotal = runningTotal*10 + a;
        document.getElementById("text").innerText = runningTotal;
    }
    </script>

0