Ask Question

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 either varA or varB are strings

• "bigger" if varA is larger than varB

• "equal" if varA is equal to varB

• "smaller" if varA is smaller than varB

+2
Answers (1)
  1. 22 March, 19:21
    0
    StrA = isinstance (varA, str) strB = isinstance (varB, str)

    if strA or strB = = True: print ("String involved.")

    elif varA > varB: print ("bigger")

    elif varA = = varB: print ("equal")

    elif varA < varB: print ("smaller")
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Assume that two variables, varA and varB, are assigned values, either numbers or strings. Write a piece of Python code that prints out one ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers