Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a function strW changedChar(...) that receives three parameters: a string ( orig ) and two characters ( ch1 and ch2 ). The function should

Define a function strWchangedChar(...) that receives three parameters: a string (orig) and two characters (ch1 and ch2). The function should return a NEW STRING containing the same characters as in the original string (orig) except that in those positions where the character ch1 is in the original string the new string should have the character ch2. If the character ch1 is not present in the original string then the new string to be returned should be the same as the original string. Lower case or upper case are not changed.

As an example, the following code fragment:

print (strWchangedChar("---1--1-1--","1","2"))

should produce the output:

---2--2-2--

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

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago