Remove all characters except given character 

In this program, we will take a string as input and remove all characters except the given character in a string. 

Steps to solve the program
  1. Take a string as input.
  2. Remove all characters except the given character and add them to the list using list comprehension.
  3. Use for loop to iterate over each character of the string.
  4. Print the output.
				
					#Input string
str1 = "Sqatools python"

#Printing output
print(''.join([el for el in str1 if el == "S"]))
				
			

Output :

				
					S
				
			

create a string from two given strings combining uncommon characters of the said strings.  

Count all the Uppercase, Lowercase, special character and numeric values in a given string

Leave a Comment