<font color=#ffa994> Hack 1: Check Voting Eligibility </font>

Description: This hack checks if a person is eligible to vote based on their age.

  1. Define a function named checkVotingEligibility that takes one parameter called age.
  2. Inside the function, use an if statement to check if the age is 18 or older.
    • Return the message "You are eligible to vote!" if true; otherwise, return "You are not eligible to vote yet.".

Call the function with different age values ```python result1 = checkVotingEligibility(20) result2 = checkVotingEligibility(17)

print(result1) # Output: You are eligible to vote! print(result2) # Output: You are not eligible to vote yet.

<font color=#ffa994> Hack 2: Grade Calculator </font>

Description: This hack assigns a letter grade based on a numerical score.

  1. Define a function named getGrade that takes one parameter called score.
  2. Use if...else if...else statements to determine the letter grade based on the score:
    • Return "Grade: A" for scores 90 and above.
    • Return "Grade: B" for scores between 80 and 89.
    • Return "Grade: C" for scores between 70 and 79.
    • Return "Grade: F" for scores below 70.

Call the function with different scores ```python result1 = getGrade(85) result2 = getGrade(72)

print(result1) # Output: Grade: B print(result2) # Output: Grade: C

<font color=#ffa994> Hack 3: Temperature Converter </font>

Description: This hack converts temperatures between Celsius and Fahrenheit.

  1. Define a function named convertTemperature that takes two parameters: value (the temperature) and scale (either “C” or “F”).
  2. Use an if statement to check the scale:
    • If it’s “C”, convert the temperature to Fahrenheit using the formula (value * 9/5) + 32 and return the result with "°F".
    • If it’s “F”, convert to Celsius using (value - 32) * 5/9 and return the result with "°C".
    • If the scale is neither, return an error message.

Test the function with different values and scales ```python result1 = convertTemperature(100, “C”) result2 = convertTemperature(32, “F”)

print(result1) # Output: 212.00 °F print(result2) # Output: 0.00 °C