From 07f81d5b580ea94f79658948479978af6905d697 Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Wed, 5 Mar 2025 23:57:49 +0000 Subject: [PATCH] Revert "Completed 10-8 Cats and Dogs" This reverts commit d70f69744d1b93c9a7e96fc5fd2dbd22482320b1. --- Chapter_10/10-8_cats_and_dogs.py | 25 ------------------------- Chapter_10/cats.txt | 3 --- Chapter_10/dogs.txt | 3 --- 3 files changed, 31 deletions(-) delete mode 100644 Chapter_10/10-8_cats_and_dogs.py delete mode 100644 Chapter_10/cats.txt delete mode 100644 Chapter_10/dogs.txt diff --git a/Chapter_10/10-8_cats_and_dogs.py b/Chapter_10/10-8_cats_and_dogs.py deleted file mode 100644 index 3b24e93..0000000 --- a/Chapter_10/10-8_cats_and_dogs.py +++ /dev/null @@ -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) \ No newline at end of file diff --git a/Chapter_10/cats.txt b/Chapter_10/cats.txt deleted file mode 100644 index f15abf2..0000000 --- a/Chapter_10/cats.txt +++ /dev/null @@ -1,3 +0,0 @@ -Terry -Jones -Spooter \ No newline at end of file diff --git a/Chapter_10/dogs.txt b/Chapter_10/dogs.txt deleted file mode 100644 index ba98b23..0000000 --- a/Chapter_10/dogs.txt +++ /dev/null @@ -1,3 +0,0 @@ -Frank -Chonk -Gonzo \ No newline at end of file