Program to check whether the input is a string

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
  1. Take input from the user.
  2. Check the type of input by using type().
  3. Check whether the given input is a string using an if-else statement.
  4. Print the output.
				
					str1 = "Hello"

if type(str1) == str:
    print("True")
else:
    print("False")
				
			

Output :

				
					True
				
			

Related Articles

check whether the given number is float or not.

print all the numbers from 10-15 except 13

Leave a Comment