Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
What do these lines show? print(5 > 3), print(2 == 3), print("a" == "a"), print(type(5 > 3)). (The sign == asks: are the two sides equal?)
== compares. = stores. A comparison gives a bool.
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.
5 > 3 is true, so it shows True.2 == 3 asks if 2 equals 3. It does not, so it shows False."a" == "a" compares two equal texts: True.bool, so the last line shows <class 'bool'>.Careful. A single = stores a value. A double == compares two values.
Answer: True, False, True and <class 'bool'>.
Log in to join the discussion.
Loading…