I need this little snippet to output "this is a string" (i need myVar to satisfy the condition is str)
myVar = 'some-string'
if myVar is str:
print('this is a string')
else:
print('this is NOT a string')
but when i run it, it keeps outputting "this is NOT a string". I don't understand, can someone please point out what I'm doing wrong and how to fix it?
I've also tried:
myVar = str('some-string')
if myVar is str:
print('this is a string')
else:
print('this is NOT a string')
and it also doesn't work.
I can't use isinstance() to check anything, I MUST keep the conditional of
if myVar is str:
and this conditional must evaluate to True.
i've also tried this:
if 'some-string' is str:
print('this is a string')
else:
print('this is NOT a string')
and this also outputs "this is NOT a string"
I don't know what i need to do to feed it something which satisfies this condition