Notes

Popcorn hacks and homework hacks

Popcorn hack one

Popcorn Hacks 1️⃣ Which image format is best for logos and transparency?

  • PNG 2️⃣ Which format loses quality to make the file size smaller?
  • JPG 3️⃣ Which format is used for simple animations, like memes?
  • GIF

    Popcorn hack two

POPCORN HACK: Decode This! Question: What does this Base64 string decode to? U1Q=

U1Q= → ST

  • U = 20 → 010100
  • 1 = 53 → 110101
  • Q = 16 → 010000 Together = 01010011 01010100 = ASCII for “ST”

Homework Hack 1

def decimal_to_binary(decimal_num):
    """Converts a decimal number to a binary string."""
    if decimal_num >= 0:
        return bin(decimal_num)[2:]
    else:
        return '-' + bin(abs(decimal_num))[2:]

def binary_to_decimal(binary_str):
    """Converts a binary string to a decimal number."""
    if binary_str.startswith('-'):
        return -int(binary_str[1:], 2)
    else:
        return int(binary_str, 2)

# --- Testing the functions ---

# Decimal to Binary
print("Decimal to Binary Tests:")
print(decimal_to_binary(10))   # Output: 1010
print(decimal_to_binary(0))    # Output: 0
print(decimal_to_binary(-7))   # Output: -111

# Binary to Decimal
print("\nBinary to Decimal Tests:")
print(binary_to_decimal("1010"))   # Output: 10
print(binary_to_decimal("0"))      # Output: 0
print(binary_to_decimal("-111"))   # Output: -7

Homework Hack 2

import time

difficulty = input("Enter difficulty (easy, medium, hard): ").lower().strip()

while difficulty not in ["easy", "medium", "hard"]:
    print("Please enter a valid difficulty level.")
    difficulty = input("Enter difficulty (easy, medium, hard): ").lower().strip()
    time.sleep(0.5)

print("Difficulty set to:", difficulty)
Difficulty set to: easy
My Mood Board

:art: My Mood Board

#87CEEB
#FF7F50
#0ACDFF
#60AB9A
#DEDEE0

10:12

My Base64 Profile Pic

:school_satchel: My Embedded Profile Picture

Profile Picture