Hack 1: Odd or Even Checker

Description: This hack checks if a given number is odd or even.

  1. Define a function named check_odd_even that takes one parameter: number.
  2. Use an if statement to check if the number is divisible by 2.
  3. Return "Even" if true; otherwise, return "Odd".

Call the function with different numbers to test your work.

Hack 2: Leap Year Checker

Description: This hack determines if a given year is a leap year.

  1. Define a function named is_leap_year that takes one parameter: year.
  2. Use an if statement to check if the year is divisible by 4 but not by 100, or divisible by 400.
  3. Return "Leap Year" if true; otherwise, return "Not a Leap Year".

Call the function with different years to test your work.

Hack 3: Temperature Range Checker

Description: This hack checks if a given temperature is considered cold, warm, or hot.

  1. Define a function named temperature_range that takes one parameter: temperature.
  2. Use if...elif...else statements to categorize the temperature:
    • Return "Cold" for temperatures below 60°F.
    • Return "Warm" for temperatures between 60°F and 80°F.
    • Return "Hot" for temperatures above 85°F.

Call the function with different temperature values to check your work.