Day 5
String :
The string is an in-built data structure in python, which is an immutable data type, that is a sequential collection of characters.
Because String is an immutable data type so we cannot change the string after it's written.
Let's solve a few problems on String :
- Write a python program to check whether the string is palindrome or not
Logic: You have to check whether the word, you are reading from forward is the same as you are reading from backward.
s=str(input("Enter your String : "))
if s[::-1] == s:
print("String is Palindrome")
else:
print("String is not Palindrome")
Output:
- Write a python program to join and split a string
Logic: First you have to split a string and join it through '-'
n='BASICS OF PYTHON'
print(n.split(" "))
print('-'.join(n.split()))
Output :
Here are a few problems on String :
Write a python program to find Reverse words in a given String in Python
Write a python program to remove i’th character from a string in Python
Write a python program to avoid Spaces in string length
Write a python program to print even-length words in a string
Write a python program to uppercase Half String
Write a python program to capitalize the first and last character of each word in a string
Write a python program to check if a string has at least one letter and one number
Write a python program to accept the strings which contain all vowels
Write a python program to count the number of vowels using sets in a given string
Write a python program to remove all duplicates from a given string
Write a python program to check the Least Frequent Character in a String
Write a python program to find Odd Frequency Characters
Write a python program to a specific Characters Frequency in the String List
Write a python program to check the Frequency of numbers in a String
Write a python program to check if a string contains any special character
Write a python program to generate random strings until a given string is generated
Write a python program to find words that are greater than the given length of k
Write a python program to remove i-th character from a string
Write a python program to find the length of a string in python
Write a python program to count the number of matching characters in a pair of string
Write a python program to check the Maximum frequency character in the String
In my next blog,you will get to know about tuples data type.
Thank you.