Revert "Completed 10-8 Cats and Dogs"

This reverts commit d70f69744d1b93c9a7e96fc5fd2dbd22482320b1.
This commit is contained in:
cheeks 2025-03-05 23:57:49 +00:00
parent d70f69744d
commit 07f81d5b58
3 changed files with 0 additions and 31 deletions

View File

@ -1,25 +0,0 @@
# Exercise 10-8 Cats and Dogs
# Learning Objective: Read from two files and include a try except section to catch file not found error.
from pathlib import Path
cats = Path("./Chapter_10/cats.txt")
dogs = Path("./Chapter_10/dogs.txt")
combined_list = []
try:
cats_content = cats.read_text()
except FileNotFoundError:
print(f"Sorry, the file {cats} doesn't exist.")
else:
for name in cats_content.splitlines():
combined_list.append(name)
try:
dogs_content = dogs.read_text()
except FileNotFoundError:
print(f"Sorry, the file {dogs} doesn't exist")
else:
for name in dogs_content.splitlines():
combined_list.append(name)
print(combined_list)

View File

@ -1,3 +0,0 @@
Terry
Jones
Spooter

View File

@ -1,3 +0,0 @@
Frank
Chonk
Gonzo