Rashina
asked

Expert
Sarthak Baral answered
Hi Rashina,
In Python, you can check this using isinstance():
value = "Hello"
if isinstance(value, str):
print("It is a string")
else:
print("It is not a string")
Just replace value with the variable you want to test.
If you have more questions, I am here to help π
Python
This question was asked as part of the Number Guessing Game course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer
