Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise-1: Create a function that fits the following specification: Name: String_reverse Argument: a string Return: a reversed string Here is an example of how to

Exercise-1: Create a function that fits the following specification:

Name: String_reverse Argument: a string Return: a reversed string

Here is an example of how to use (or test) the function: a = python rocks b = String_reverse(a) returns skcor nohtyp

Use the above function to check if a string is a palindrome or not. Print Yes if its a palindrome and no if it is not a palindrome. A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples: madam, nun, etc.

Exercise-2: Create a function that fits the following specification:

Name: Char_count Argument: a string Return: none Prints: frequencies of each character

Here is an example of how to use (or test) the function: Char_count(aababcdcd) Prints: a:3, b:2, c:2, d:2

Exercise-3: Write a general function that removes all occurrences of a string from another string.

Name: RmvChar_string Argument: string1, string2 Return: string1 without any character present in string2

Here is an example of how to use (or test) the function: a = abcdef b = gheijf c=RmvChar_string(a,b) print c # Prints: abcd

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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions