Assume that two variables, varA
and varB
, are assigned values, either numbers or strings.
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
For problems such as these, do not include raw_input
statements or define the variable varA
or varB
. Our automating testing will provide values of varA
and varB
for you - so write your code in the following box assuming varA
and varB
are already defined.
if isinstance(varA, str) or isinstance(varB, str):
print('string involved')
elif varA > varB:
print('bigger')
elif varA == varB:
print('equal')
else:
print('smaller')