Question: 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
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 m below. If either file does
not exist, the program should print out the message "Unable to access one or more files".
b Open the file named dognames.txt in the CPTStuffpetsdogs folder in the read mode.
c Print the contents of the file.
d Close the file.
e Open the file named catnames.txt in the CPTStuffpetscats folder in the read mode.
f Print the contents of the file.
g Close the file.
h Open the catnames.txt file in the append mode.
i Add two cat names to the file. You can pick the names. The example output below shows
the names Mortimer and Tigger added.
j Close the file.
k Open the catnames.txt file in read mode.
l Print the contents of the file.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
