Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Python program Your program will take file name and it's content from the user. Save all the input from the user to the

Create a Python program

Your program will take file name and it's content from the user.

Save all the input from the user to the file that was created.

Once user is done with providing the content, display the file content on the monitor.

Make sure the validity of the file name.

Valid file name should adhere to the following rules:

Should begin with Alphabets or "_".

Name can consist of digits, Alphabets and "_".

Can not contain any special characters.

For this assignment, filename needs to have an extension and any extension will be fine.

If the filename that user provides is not a valid one, you need to inform the user about it and ask for a proper name.

Once proper filename has been entered, take an input line by line. After each line input, ask user whether to add more lines and depends on the response, your program will take additional input or stop taking it.

Once done with input for a file, your program needs to ask user whether to create another file or not. Depends on the response from the user, your program either stop altogether or start to take another line by line input for a new file.

After closing the file, your program needs to display the file content to the user.

Once program execution is complete, files should have been created with all the content provided by the user in the directory where your program is.

For this assignment, use of functions and regular expression is required.

Grading policy:

If it doesn't run (any error): at least 70% point deduction.

Improper code formatting or lack of appropriate comments: 10% to 30% point deduction.

If it doesn't produce the required result: at least 40% point deduction.

If your source code file contains the topics that haven't been discussed in class, you will loose at least 30% of points.

If your program doesn't use regular expression or functions, at least 30% point deduction.

Late submission will get 20% to 40% point deduction depends on how late it is.

=====================================================================

Sample input/output (User input is in blue)

>>>

>>> ============= RESTART: ============= Please enter a filename: abc File name needs to have an extension. Plese enter a proper filename: abc.4#r Filename can contain only Alphabets, digits and "_". Plese enter a proper filename: 23ab.exe Filename only can start with Alphabets or '_'. Plese enter a proper filename: abc#$.txt Filename can contain only Alphabets, digits and "_". Plese enter a proper filename: abc@#abc.txt Filename can contain only Alphabets, digits and "_". Plese enter a proper filename: Test1.txt Please enter a sentence: This is the first line. Do you want to add more lines? (Y/N) y Please enter a sentence: This is the second line. Do you want to add more lines? (Y/N) n

This is what's entered into file Test1.txt. ============================= This is the first line. This is the second line. ============================= Do you want to create another file? (Y/N) y Let's create another file. Please enter a filename: 3ab.doc Filename only can start with Alphabets or '_'. Plese enter a proper filename: Test.doc Please enter a sentence: Test.doc the first line. Do you want to add more lines? (Y/N) y Please enter a sentence: Test.doc !@#$%&*() Do you want to add more lines? (Y/N) y Please enter a sentence: Test.doe the third line. Do you want to add more lines? (Y/N) n

This is what's entered into file Test.doc. ============================= Test.doc the first line. Test.doc !@#$%&*() Test.doe the third line. ============================= Do you want to create another file? (Y/N) n Thank you for playing! >>>

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

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago