card 1 of 37
3>2
common sense
True
card 2 of 37
1>3
common sense
False
card 3 of 37
5==5
by an accident of computer language history, this is equality test
True
card 4 of 37
6==6.1
the integer is converted to a float, then comparison occurs
False
card 5 of 37
4==2+2
arithmetic (*, +, -, /, etc) has priority over comparison
True
card 6 of 37
12=2*6
look carefully
SyntaxError: can't assign to literal (use == instead of =)
card 7 of 37
3.0 ==9.0/3.0
arithmetic expressions are evaluated before comparison
True
card 8 of 37
(3.0==9.0)/3.0
although this is valid Python, it is not good style
0.0
card 9 of 37
9e28==9e28+9e-60
Python float is limited in numeric precision it can represent
True
card 10 of 37
'a' == "a"
string comparison is by value, not by the style of data entry
True
card 11 of 37
'b'=='b '
blanks can be characters in a string
False
card 12 of 37
'a'+'b'=='ab'
string operators and functions are evaluated before comparison
True
card 13 of 37
'a'>'q'
comparison of characters is by alphabetic order
False
card 14 of 37
'j'<'r'
comparison of characters is by alphabetic order
True
card 15 of 37
'e'<'e'
common sense
False
card 16 of 37
'E'<'e'
uppercase characters are considered smaller than lowercase ones
True
card 17 of 37
'b'>'O'
uppercase characters are considered smaller than lowercase ones
True
card 18 of 37
"abc"<"def"
strings are compared alphabetically (as in phone books)
True
card 19 of 37
"Enormous">"tiny"
this is "lexicographic" comparison
False
card 20 of 37
3<=0
pronounced "less than or equal to"
False
card 21 of 37
3<=3
pronounced "less than or equal to"
True
card 22 of 37
3<=5
pronounced "less than or equal to"
True
card 23 of 37
(3<=5) == (3<5 or 3==5)
comparison is evaluated before logical operators (and, or, not)
True -- read outloud and it makes some sense
card 24 of 37
not 3<=0
comparison is evaluated before logical operators (and, or, not)
True
card 25 of 37
5>2
common sense
True
card 26 of 37
5>7 == 7<5
comparison is evaluated left-to-right
False
card 27 of 37
(5>7) == (7<5)
comparison is evaluated left-to-right
True
card 28 of 37
3!=0
pronounced "not equal"
True
card 29 of 37
(3!=0) == (not 3==0)
read aloud, it is almost common sense
True
card 30 of 37
'a' in "wanted"
like a search, returning True or False
True
card 31 of 37
'z' in "panda"
like a search, returning True or False
False
card 32 of 37
"and" in "panda"
like a search, returning True or False
True
card 33 of 37
"and" in "an old tree"
like a search, returning True or False
False
card 34 of 37
"ant" in "an"+"tidote"
operators and functions are evaluated before the in-test
True
card 35 of 37
not 'z' in "panda"
the in-test is evaluated before logical operators (and, or, not)
True
card 36 of 37
'z' not in "panda"
actually, "not in" is a new operator
True
card 37 of 37
((("ave" in "avenue") and 6<=6) or ('people' in "k" or 9*55/(2.3+0.001)>0))
you may need to work this out on paper
True
(use browser reload to restart this problem set)