Replace several characters at once
Write a Python program to replace a with 1, t with 2 and o with 3 in one step. Step-by-step explanation, colour-coded code and real output.
Online Learning Platform
Free tutorials, solved practice problems and interview prep for QA and automation engineers: Python, Playwright, Selenium, SQL, Git and more.
Write a Python program to replace a with 1, t with 2 and o with 3 in one step. Step-by-step explanation, colour-coded code and real output.
Write a Python program to replace several words using a dictionary of replacements. Step-by-step explanation, colour-coded code and real output.
Write a Python program to split a string wherever a vowel appears. Step-by-step explanation, colour-coded code and real output.
Write a Python program to print the mirror image (reverse) of a string. Step-by-step explanation, colour-coded code and real output.
Write a Python program to build a string from the first 2 and last 2 characters. Step-by-step explanation, colour-coded code and real output.
Write a Python program to get the first 4 characters of a string. Step-by-step explanation, colour-coded code and real output.
Write a Python program to find the words longer than a given length. Step-by-step explanation, colour-coded code and real output.
Write a Python program that repeats each vowel 3 times and each consonant 2 times, leaving spaces...
Write a Python program to replace the second occurrence of every character with "$". Step-by-step explanation, colour-coded code and real output.
Write a Python program to find the character that repeats most times in a row (consecutively) in a...
Write a Python program to find the least frequent character in a string. Step-by-step explanation, colour-coded code and real output.
Write a Python program to count how many times a whole word occurs in a string. Step-by-step explanation, colour-coded code and real output.
Take free timed mock tests with answers and explanations.