Popcorn Hack #1


og_price = 10.00
student_discount = 0.20
child_discount = 0.50
senior_discount = 0.30

answer = input("Enter your age to see if you quailfy for the discount: ")

if 0 <= answer <= 12:
    total_price = og_price * child_discount
    print("You quailify for the 50 percent discount! Your total is $", total_price)
elif 13 <= answer <= 63:
    total_price = og_price
    print("You sadly do not quailify for the discount! You total is $", total_price)
elif answer > 63:
    total_price = og_price*senior_discount
    print("You quailify for the 30 percent discount! Your total is $", total_price)
else:
    print("Sorry there must be a error in your input, try again")
    answer = input("Enter your age to see if you quailfy for the discount: ")


Popcorn Hack #2


og_price = 10.00
student_discount = 0.20
child_discount = 0.50
senior_discount = 0.30

answer = input("Enter your age to see if you quailfy for the discount: ")

if 0 <= answer <= 12:
    total_price = og_price * child_discount
    print("You quailify for the 50 percent discount! Your total is $", total_price)
elif 13 <= answer <= 63:
    total_price = og_price
    print("You sadly do not quailify for the discount! You total is $", total_price)
elif answer > 63:
    total_price = og_price*senior_discount
    print("You quailify for the 30 percent discount! Your total is $", total_price)
else:
    print("Sorry there must be a error in your input, try again")
    answer = input("Enter your age to see if you quailfy for the discount: ")


if answer % 2 == 0:
    print(f"The number {number} is even.")
else:
    print(f"The number {number} is odd.")



Homework


while True:
    user_input = input("Please enter a positive number: ")

    try:
        number = float(user_input)
    except ValueError:
        print("Error: That is not a valid number. Please try again.")
        continue
        
    if number > 0:
        print(f"Success! You entered a positive number: {number}")
        break
    else:
        print("Try again. Please enter a positive number.")