Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CPT 180: Shell Scripting I need some help/tutor on how to begin this. I have read part of the Automate the Boring Stuff with Python

CPT 180: Shell Scripting

I need some help/tutor on how to begin this. I have read part of the "Automate the Boring Stuff with Python" book (2nd Edition). If you can help guide me on what pages it associates with so I can learn how to do it step by step.

This goes along with my previous question for the first assignment.

image text in transcribedimage text in transcribed

4. Directions Using the following guidelines, create a python program. 1. You will be using the CPT180Stuff folder from Assignment 1 for this assignment. 2. Create a program named workWithFiles2.py. 3. Add three comment lines at the top of the program that contain: a. Program Name b. Program Description C. Programmer's Name (You) Write code that will do the following: a. 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 CPT180Stuff\pets\dogs 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 CPT180Stuff\pets\cats 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. Add two cat names to the file. You can pick the names. The example output below shows the names Mortimer and Tigger added. 1. Close the file. k. Open the catnames.txt file in read mode. 1. Print the contents of the file. m. Close the file. 5. Submit the workWithFiles2.py file into the Chapter 8 - 9 Assignment 2 Submission Folder. i. Hints 1. Ensure to add the newline character at the end of each name added to the file. Python 3.6.4 Shell File Edit Shell Debug Options Window Help Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64) ] on win32 Type "copyright", "credits" or "license()" for more information. ======== RESTART: G:/TTC Courses/cpt180/Assignments/workWithFiles2.py ===== Spot Max Lassie Rover Snoopy Misty Felix Fluffy Kimba Tom Misty Felix Fluffy Kimba Tom Mortimer Tigger >>> |

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago