Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BASIC PYTHON PROGRAM QUESTION (PHOTO) CS 3A Winter 2018 Assignment #5 February 5, 2018 Programming Assignment 5 (40 points) Due date: February 14, 2018at 11:59

BASIC PYTHON PROGRAM QUESTION (PHOTO)

image text in transcribedimage text in transcribed

CS 3A Winter 2018 Assignment #5 February 5, 2018 Programming Assignment 5 (40 points) Due date: February 14, 2018at 11:59 PM Assignment Overview This assignment provides practice in defining and using functions. We would like to demonstrate our ability to control strings and use functions Text Processing [40 points] There are times when a program has to search for and replace certain characters in a string with other characters. This program will look for an individual character, called the key character, inside a target string. It will then perform various functions such as replacing the key character with an asterisk() wherever it occurs in the target string. For example, if the key character were and the string were He who laughs last, laughs fast, faster, FASTEST. then the operation of replacing the by an asterisk would result in the new string: He who l'ughs I'st, ughs Pst, ster, FASTEST. As you can see, only the lower-case 'a' was detected and replaced. This is called "case-sensitivity" and this entire program spec is case-sensitive This was only one possible task we might perform. Another would be to remove all instances of the key character rather than replace each with an asterisk. Yet a third might be to count the number of key characters. Ask the user to enter both a key character and a target string (phrase, sentence, ec.Then, show the user three things: L. The target string with the key character replaced by asterisks. 2. The target string with the key character removed 3, The number of occurrences of the key character (ase sensitive) in the target string. This program does not loop for different strings. Once it processes a string, the program ends. .Here,"character" means any printable character. They can be letters, numbers, or even special symbols. Each target input string should be complex with a mix of characters, special symbols, numbers to show how the program handles each category. Input Function Specs def getayCharacter This function requests a single character from the user and continues to ask for it until the user gets it right: this function will test to make sure the user only types one single character. 0,2, 3 or more characters will be flagged as an emor and the function will keep at the user until he types just one character

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions