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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!