How to see if a string starts with a string python?
Answers
Answered by
0
Hey mate ^_^
Here is ua answer.... ⏬⏬
Check this attachment :-)
#Be Brainly❤️❤️
Here is ua answer.... ⏬⏬
Check this attachment :-)
#Be Brainly❤️❤️
Attachments:
Answered by
0
According to the question, we need to know whether the phrase is a string or not.
First, let's take a variable name.
string = 'James bond'
Now, we will not know whether this is a string or not. Hence, let's first convert the string into a string type.
Now, we need to see whether they are equal or not, if they are equal, we can now that we have a string. If not, it might be another type.
if string == str(string):
print('Yes, your phrase is a string')
else:
print('No, your phrase is not a string')
if our string was 'James bond', we will get an output as Yes, your phrase is a string
if our string is 145 or any other number, we will get an output as No, your phrase is not a string.
Similar questions