Write a piece of Python code that prints out one of the following messages:
-
"string involved"
if eithervarA
orvarB
are strings
-
"bigger"
ifvarA
is larger thanvarB
-
"equal"
ifvarA
is equal tovarB
-
"smaller"
ifvarA
is smaller thanvarB
if type(varA) == str or type(varB) == str: print 'string involved' elif varA > varB: print 'bigger' elif varA == varB: print 'equal' else: # If none of the above conditions are true, # it must be the case that varA < varB print 'smaller'
No comments:
Post a Comment