Below is a Python code snippet that accomplishes what you described:
# Assuming num_dogs, num_cats, and budget are defined before this point
try:
# Calculate per-pet budget
per_pet_budget = budget / (num_dogs + num_cats)
# Display the result rounded to two decimal places
print(f"Per-pet budget: ${per_pet_budget:.2f}")
except ZeroDivisionError:
print("Unavailable - Division by zero error.")
In this code, a try-except block is used to handle the possibility of a division by zero error. If the division is successful, it calculates the per-pet budget and prints it rounded to two decimal places. If a division by zero error occurs, it prints the message "Unavailable."