Starting from:

$25

ITSE1359-Program 10 Solved

Requirements (remember to identify the requirements by number):

•        Create a file using PyCharm.

•        Name the source file program_10.py.

•        Format code like the examples.

•        Include comments in your code like the examples.

•        Code the requirements in the numbered list below.

•        Output a header in the console: “This is Program 10”

This program requires the use of pyperclip, a module to work with the clipboard.

Command Line - Navigate to your working directory and run the commands:

C:\python -m pip install --upgrade pip   -   upgrade pip installer

C:\pip install pyperclip   -   install pyperclip

C:\set PYTHONPATH=.   -  may need if your PYTHONPATH is not set correctly 

 

In PyCharm | Settings, add the pyperclip package using the following steps:  

 

             

Find the pyperclip package in the list on the left and select Install Package.

 

 

PyCharm should report that the pyperclip package was installed successfully. Select OK.

 

 

 

             

Requirements to be numbered in program_10.py:  

 

 

1.    Print “This program manipulates text from files and the clipboard and performs other string, file, and directory manipulation tasks.”

2.    Output the current working directory of the program.

3.    Ask the user to enter the directory where they would like files to be stored, make that directory, and store files in the program in that directory.

4.    Write the following three lines to file_one.txt (without bullet points):

•        Line 1 from file_one wrong_text

•        Line 2 from file_ one wrong_ text

•        Line 3 from file_ one wrong_ text

5.    Display the contents of file_one.txt.

6.    Programmatically replace the substring ‘file_one  wrong_text’ in data read from file_one.txt with ‘file_two correct_text’ and write the corrected lines to file_two.txt.

7.    Ask the user to type the following lines (without bullet points) into Notepad++ and copy the lines to the clipboard (using Ctrl-c):

•        Line 1 from the clipboard

•        Line 2 from the clipboard • Line 3 from the clipboard

8.    Programmatically display the contents of the clipboard which should contain the three lines from Requirement 5.

9.    Read the contents of file_two.txt and read the contents of the clipboard. 

10.Append the contents of the clipboard onto the contents of file_two.txt line-by-line to produce the following:

•        Line 1 from file_two followed by Line 1 from the clipboard

•        Line 2 from file_two followed by Line 2 from the clipboard • Line 3 from file_two followed by Line 2 from the clipboard 11. While performing Requirement 8, write the lines out to file_three.txt.

12.  Display the contents of the file_three.txt.

13.  Ask the user for a new directory name. Programmatically create that directory and programmatically copy the files created earlier in the program to the new directory. Programmatically compress the files in the new directory.

14.  Print a statement explaining your experiences with Program 10.

TEST – TEST – TEST your application to ensure the specific program requirements are met.

•        Use the list above and the common requirements as a confirmation checklist.

More products