Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Say what each comparison gives, True or False.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Plan. Compare the text letter by letter, and remember that capital letters come before small letters.
"cat" == "cat": the same letters. True."cat" == "Cat": the first letter is different (c and C). False."cat" != "dog": they are different. True."cat" < "dog": c comes before d. True."Dog" < "cat": a capital D comes before every small letter. True."10" == 10: text and a number are never equal. False."10" < "9": text is compared character by character: 1 comes before 9. So "10" is less than "9". True. (As numbers, 10 is more than 9. This is why you must change text to numbers first.)Answer: True, False, True, True, True, False, True.
Common mistake. Comparing numbers that are stored as text. "10" < "9" is True.
Log in to join the discussion.
Loading…