Computer Science, asked by sankalanbhattacharya, 5 months ago

What is the output of the following string comparison

print("John" > "Jhon")

print("Emma" < "Emm")

Answers

Answered by shivamsaxena8794
0

Answer:

The output will be True and False respectively..

Explanation:

Answered by PravinRatta
1

The output of the following string comparison are:

  1. print("John" > "Jhon") - True
  2. print("Emma" < "Emm") - False

In a programming language like Python 3, comparison operators are used to comparing two strings.

  • In the statement "John" > "Jhon". The compiler will compare character by character the two given strings. The first character is "J" in both strings. So, the compiler will move forward. The next character is "O" and "H," the alphabetical value of "O" is greater than "H." So, print("John" > "Jhon")  is True.
  • In the statement "Emma" > "Emm". The compiler will compare character by character the two given strings. The first, second, and third characters are the same in both the strings. So, the compiler will move forward. The next character is "a" in the word "Emma". The string has more characters in Emma. So, print("Emma" < "Emm")  is False.

Similar questions