Friday , September 20 2024

The following code: print(‘Mike’ > “Mikey”) prints:

Questions BankCategory: Python Essentials 2The following code: print(‘Mike’ > “Mikey”) prints:
The following code:

print('Mike' > "Mikey")
 

prints:
  • True
  • 1
  • 0
  • False

Explanation: The > operator, when used with strings, compares character for character. This means characters in the same positions are compared from both the strings. Since Mike is shorter than Mikey, it cannot be greater. Therefore, the answer is False.

More Questions: Python Essentials 2 – Module 2 Test