
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
![Task 12
Write a python program that takes 2 inputs from the user. The first input is a string and the second input is a letter. The program should remove all occurences
of the letter from the given string and print the output. If the letter is not found in the string and the length of string is greater than 3, then remove the first letter
and last letter of the given string and print it. Otherwise print the string as it is. [You can assume that all the input will be in lowercase letter]
Sample Input 1:
tanjiro kamado
a
Sample output 1:
tnjiro kmdo
Explanation: All 3 instances of the character 'a' is removed from the input String 'tanjiro kamado' to give us output 'tnjiro kmdo'.
========
========](https://content.bartleby.com/qna-images/question/6252f437-6b4a-46c1-b78f-e425cf26b924/28d04718-9266-4a55-92a1-47f0920ca4dc/2op0csl_thumbnail.png)
Transcribed Image Text:Task 12
Write a python program that takes 2 inputs from the user. The first input is a string and the second input is a letter. The program should remove all occurences
of the letter from the given string and print the output. If the letter is not found in the string and the length of string is greater than 3, then remove the first letter
and last letter of the given string and print it. Otherwise print the string as it is. [You can assume that all the input will be in lowercase letter]
Sample Input 1:
tanjiro kamado
a
Sample output 1:
tnjiro kmdo
Explanation: All 3 instances of the character 'a' is removed from the input String 'tanjiro kamado' to give us output 'tnjiro kmdo'.
========
========
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write a python program where you will be given a string that contains multiple sentences separated by a comma. Your task is to separate the vowels and consonants in each word of each sentence and put the consonants at the start of the word and the vowels at the end and when doing so you have to ignore repeating vowels and consonants in a specific word. Sample Input 1: "Hello there, I will have tea, General Kenobi, I will be back" Sample Input 2: "Go go power rangers, There is no place like home, You have got a friend in me" Sample output 1: Hleo thre, I wli hvae tea, Gnrlea Knbeoi, I wli be bcka Sample Output 2: Go go pwroe rngsae, Thre si no plcae Ikie hmoe, You hvae gto a frndie ni mearrow_forwardDesign a program with an algorithm that will take a string from the user and then decide if each character in that string is unique. For example, if you ask the user to enter a string and that user enters the world ‘hello’, the result of the algorithm implementedshould return ‘false’ or ‘not unique’. If the user enters a string such as the word ‘phone’ the program will return ‘true’ or ‘unique’ since every character in the word phone is unique and is not repeated. An example of this program follows: Output should show as : enter a string rizma This string has all the unique characters would u like to continue?(y for yes n for no) y Enter a string waali This string is not unique Your code should work for all strings and essentially all characters, as many examples will be tested.arrow_forwardWrite a Java Program to take a string from the user and your task is to print the length of the longest palindromic string which can be formed from the user. per string character.arrow_forward
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education