# Hack 1: A simple function to decide if you should go outside
def go_outside(temperature, is_raining):
"""
Determines if it's a good idea to go outside based on the temperature and weather.
Args:
temperature (int or float): The temperature outside in degrees.
is_raining (bool): A boolean that tells us if it's raining (True means raining, False means no rain).
Returns:
bool: True if it's good to go outside, False if it's better to stay in.
"""
# If the temperature is less than 100 degrees and it's raining, it's fine to go outside
if temperature < 100 and is_raining:
return True # It's not too hot, and you're fine with a little rain.
# If the temperature is more than 32 degrees and it's NOT raining, go outside!
elif temperature > 32 and not is_raining:
return True # It's not freezing, and there's no rain—perfect for going out!
# If neither condition is met, it means it's either too hot or too cold, or just not ideal.
else:
return False # Better to stay inside.
# Test the function with some examples
print(go_outside(95, True)) # Output: True (It's raining, but under 100 degrees)
print(go_outside(50, False)) # Output: True (It's a nice cool day and no rain)
print(go_outside(101, False))# Output: False (Too hot to go outside)