Create a program by following these instructions. 18887916.txt is shared . Use that file. Don't try to
Fantastic news! We've Found the answer you've been seeking!
Question:
Create a program by following these instructions. 18887916.txt is shared . Use that file. Don't try to alter the content, in any way, which will return the wrong result.
- Create variables student_full_name, stdudent_id, course, and date, and assign the values in one line. Use your full name (first, last, and middle (If you have a middle name)), student id, COMP1112, and the developed date of this program as values. Print them as instructed.
- Create a Folder name from student details like "RAJESH_KHANNA_BANDI_2403699999 ". All Characters must be in Upper case, with no spaces, and first, middle, and last names separated by an underscore.
- Programmatically Check that the folder is there, and create it
- Load the Text File into the program, and read it.
- Convert the file content to a List
- Show the Total number of elements in the list. It must show like this "Total Items in List: 1917"
- Loop through the list. While iterating if the element is alpha, then add/append to its respective file as one word per line. Create Text files in the directory like A.txt, B.txt... Example...
- If the iterating value is "Rye", then add/append "Rye" to the R.txt file.
- If the iterating value is "Salinger", then add/append "Salinger" to the S.txt file.
- If the iterating value is "J.", then It's not an alpha, ignore it. No need to add anywhere.
- Programmatically print Total Text Files in the directory
- Also, output how many elements you inserted into one file. Print a detailed report as instructed.
- Use only one print statement, to print the output. If you use more than one print statement, I will deduct -5% points.
The program should include the following:
- Use the os module to programmatically get the current working directory, joining, listing, checking the existence, etc... Your program must run at any location, without doing any code changes. = (2%)
- File 'open', using 'with' keyword, or closing file = (1%)
- Using Loops = (1%)
- Writing comments about your program describing every step you take, and docstring = (2%)
- For using substring, string format, string functions = (2%)
- For using Lists = (1%)
- For doing Sum = (1%)
- For Typecasting = (1%)
- For the Right output & demonstrating your ability to use python efficiently = (2%)
- For not hardcoding, doing it in a pythonic, programmatical way = (2%)
attachment:-
SS2.png file
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date: