Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2 ( 5 0 Points ) : Write a program that will take a string as user input. Now, write a Python code that

Question 2(50 Points): Write a program that will take a string as user input. Now, write a Python code that will print all the positions of white spaces in the given string and print the modified string after removing all the whitespaces. You must write the following two functions:
findSpace(String input) : It will print the location of white spaces in the string
removeSpace(String input). It will print the modified string after removing all the whitespaces.
For example, if the user inputs "Have a nice day!" It will invoke the findSpace(String input) method and print: "Whitespaces found at positions 4,6, and 11." Then it will invoke the removeSpace(String input) method and print: "Haveaniceday!"
If the user inputs "Superman-12455" The findSpace(String input) method prints: "Whitespaces not found in this string.", and the removeSpace(String input) method prints: "Superman-12455"
You must test the following strings:
"No White Space Here"
"@@Add1Space_inThe_"
_-00_P_8_Wg"
image text in transcribed

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

1. Define mass and mediated communication

Answered: 1 week ago