Skip to the content.

3.6-3.7 HW

HW

# Hack 1
statement1 = "Hello"
statement2 = "Hello"

if statement1 == statement2:
    print("The statements are equal.")
else:
    print("The statements are not equal.")

# Hack 2
var1 = "hello"
var2 = "world"

if var1 == var2:
    print("We are the same")
elif len(var1) == len(var2):
    print("We are the same length!")
else:
    print("We are not that similar :(")

# Hack 3
numbers = []
while len(numbers) < 10:
    user_input = input(f"Enter number {len(numbers) + 1}: ")
    try:
        num = int(user_input)
        numbers.append(num)
    except ValueError:
        print("Please enter a valid number.")

print("You entered:", numbers)

# Hack 1 (3.7)

# Sample starting values
x = 15
y = 10

if x > y:
    print("x is greater than y")
    
    if x - y > 10:
        print("x is significantly greater than y by more than 10.")
    else:
        print("x is greater than y, but the difference is 10 or less.")
else:
    if x == y:
        print("x and y are equal.")
    else:
        print("x is less than y.")
        
        if y - x > 5:
            print("y is significantly greater than x by more than 5.")
        else:
            print("y is greater, but the difference is 5 or less.")

# TEENAGER STUFF

age = int(input("Enter your age: "))

if age < 13:
    print("You are a Child.")
elif age >= 13 and age < 18:
    print("You are a Teenager.")
else:
    print("You are an Adult.")