My First Test
Hello World
Proof that the square root of 2 is irrational
Here I prove that the square root of 2 is irrational.
Detailed Proof
Theorem. The square root of 2 is irrational.
Proof.
Assume that $\sqrt{2}$ is rational. This means it can be written as a fraction of two integers $a$ and $b$ in their simplest form:
$$ \sqrt{2} = \frac{a}{b} $$
Squaring both sides gives $2 = a^2/b^2$, which implies $a^2 = 2b^2$. Since $a^2$ is even, $a$ must be even ($a=2k$). Substituting back, we find that $b$ must also be even.
Since both $a$ and $b$ are even, they share a factor of 2, contradicting the assumption that the fraction is in simplest form. $\blacksquare$
Since both $a$ and $b$ are even, they share a factor of 2, contradicting the assumption that the fraction is in simplest form. $\blacksquare$
Interactive JavaScript Counter
0
// JavaScript Logic
let count = 0;
const btn = document.getElementById("js-counter-btn");
btn.addEventListener("click", () => {
count++;
});
Python Guess the Number Game
Guess a number between 1-100
Game Started. 3 tries left.
# Python Logic
secret_number = 12
for i in range(3):
guess = int(input("Guess a number from 1-100: "))
if guess > secret_number:
print("lower!")
elif guess < secret_number:
print("higher!")
else:
print("win!")
break