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...




Must show it in Python:



Please show step by step with comments.



Please show it in simplest form.



Please don't use any functions




Please don't use any def func ()


Task 12<br>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<br>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<br>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<br>letter]<br>Sample Input 1:<br>tanjiro kamado<br>a<br>Sample output 1:<br>tnjiro kmdo<br>Explanation: All 3 instances of the character 'a' is removed from the input String 'tanjiro kamado' to give us output 'tnjiro kmdo'.<br>========:<br>Sample Input 2:<br>eren yeager<br>k<br>Sample Output 2:<br>ren yeage<br>Explanation: The character 'k' is absent in the first input String 'eren yeager' and it's length is 11 which is greater than 3 therefore the first character 'e'<br>and the last character 'r' is removed. Hence, the final String is 'ren yeage'.<br>====== ======:<br>===================<br>

Extracted 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'. ========: Sample Input 2: eren yeager k Sample Output 2: ren yeage Explanation: The character 'k' is absent in the first input String 'eren yeager' and it's length is 11 which is greater than 3 therefore the first character 'e' and the last character 'r' is removed. Hence, the final String is 'ren yeage'. ====== ======: ===================
======<br>=====3=<br>Sample Input 2:<br>eren yeager<br>k<br>Sample Output 2:<br>ren yeage<br>Explanation: The character 'k' is absent in the first input String 'eren yeager' and it's length is 11 which is greater than 3 therefore the first character 'e'<br>and the last character 'r' is removed. Hence, the final String is 'ren yeage'.<br>Sample Input 3:<br>hi<br>a<br>Sample Output 3:<br>hi<br>Explanation: The letter 'a' is not found in our first input 'hi', the length of which is 2. Since the character is not present and the length is less than 3, we<br>print the String 'hi' as it is.<br>===== =======<br>==============<br>

Extracted text: ====== =====3= Sample Input 2: eren yeager k Sample Output 2: ren yeage Explanation: The character 'k' is absent in the first input String 'eren yeager' and it's length is 11 which is greater than 3 therefore the first character 'e' and the last character 'r' is removed. Hence, the final String is 'ren yeage'. Sample Input 3: hi a Sample Output 3: hi Explanation: The letter 'a' is not found in our first input 'hi', the length of which is 2. Since the character is not present and the length is less than 3, we print the String 'hi' as it is. ===== ======= ==============
Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here