Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 8 Online
OpenStudy (anonymous):

Below is the piece of code I wrote to print "string involved" when both or at least one of the variables is string but now it is printing the option under else part. Please HELP ME.... varA= 'hello' varB= 'hello' if type(varA)=="string" or type(varB)=="string": print('strings involved') else: print('no strings are not involved')

OpenStudy (microbot):

if type(varA)==str or type(varB)==str: print('strings involved') else: print('no strings are not involved') try this

OpenStudy (anonymous):

@MicroBot thanks dude its working :)

OpenStudy (microbot):

glad it does!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!