Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

sing Python 3.5!!! Substring and Palindrome: Write a program that asks the user for a three-letter substring. The program should then proceed to read the

image text in transcribed
image text in transcribed
image text in transcribed
sing Python 3.5!!! Substring and Palindrome: Write a program that asks the user for a three-letter substring. The program should then proceed to read the file strings.bxt. Each line in strings txt will contain a string. Your program should then test to see how many non- overlapping occurrences of the three-letter substring occur in that string and test whether the string is a palindrome You can read about Palendromes here) The program should then proceed to create an output file string stats.bxt, which contains the original data on one line and the number of substring occurrences and palindrome test results on the next. After that, the file should have one blank line, and then the output process should repeat. Input File is formatted such that each line is a string to be tested. Leading and trailing whitespace for each line must be deleted before processing. Output format is: Original data without ueading or trailing whitespace "n" Sub Stdog Count str(count) is or not Palindrome "In'. Note: Input files should not end with a newline. The last line in the input file should not have a newline, as having a new line will likely cause your program to check a blank line or a line with just a newline. Note: The program should handle EileNotFoundError, See Pre-Lab for more on this. Required Design Scheme: Write a function isPalindrome(bxt) o This function check if the string passed in is a palindrome, from the sample text file below, an example parameter is isPalendrome(racecar). o Returns True if it is a palindrome. o Returns False if not Write a function getPalindrome(bxt) o This function calls isPalindrome(txt) to check if the string is palindrome o It returns Is Palindrome", when the string is a palindrome. o Returns "Not Palindrome", when the string is not apalindrome. Write a function readEile(file name, target). o Takes in the file name and three letter substring o Opens the file o Creates the output data list o Close File. o Return output data Write a function write results(file name, output data) o Takes in the output file's name, and the output data

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

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago