Question
Write code that will do the following: Using an if statement, determine if both the dognames.txt file and the catnames.txt file exist. If both files
Write code that will do the following: Using an if statement, determine if both the dognames.txt file and the catnames.txt file exist.
If both files exist, the program should complete steps b e below. If either file does not exist, the program should print out the message "Unable to access one or more files".
b. Print the contents of the dognames.txt file.
c. Print the contents of the catnames.txt file.
d. Add two cat names to the catnames.txt file. You can pick the names. The example output below shows the names Sassy and Lucy added.
e. Print the contents of the catnames.txt file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started