In this python if else program, we will check whether the given input is a string or not.
A string is any series of characters that are interpreted literally by a script. For example, “python”
Steps to solve the program
- Take input from the user.
- Check the type of input by using type().
- Check whether the given input is a string using an if-else statement.
- Print the output.
str1 = "Hello"
if type(str1) == str:
print("True")
else:
print("False")
Output :
True
Related Articles
Python program to print all the numbers from 10-15 except 13.
Python program to find the electricity bill. According to the following conditions:
Python program to check whether a given year is a leap or not.
Python program to check whether an alphabet is a vowel.
Python program to check whether an alphabet is a consonant.