1
2
3
4
5
6
7
8
9
10
11
12
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to Trinket.
Post a review on Amazon for the paperback or the Kindle edition.
Email me to give me a compliment, complaint, or correction. I'll respond.
0,1,2,3,4,5,6,7,8,9,10,11
0
0
0
0
What character means "greater than"? | > | ^ *> *$ | |
What character means "less than"? | < | ^ *< *$ | |
Code the first line of an if statement testing whether the variable total is less than 100. | if total < 100: | if `total `< `100`: | |
Code the first line of an if statement testing whether the variable tax is equal to the variable minimum. | if tax == minimum: | if tax == minimum: | |
How do you write less than or equal to? | <= | ^ *<= *$ | |
How do you write greater than or equal to? | >= | ^ *>= *$ | |
Code the first line of an if statement that tests whether the sum of a and b is greater than or equal to c minus 7. | if a + b >= c - 7: | ^ *if a \+ b >= c - 7: *$ | |
Write the first line of an if statement that tests whether one variable is greater than or equal to another variable. Make up the variable names. | if max_discount >= current_discount: | ^ *if [a-zA-Z_][a-zA-Z0-9_]* >= [a-zA-Z_][a-zA-Z0-9_]*: *$ | |
Write an if statement that tests whether a variable is smaller than 99. If the test passes, assign 99 to the variable. Make up the variable name. Remember to indent the second line two spaces. | if minimum_discount < 99: minimum_discount = 99 | ^ *if ([a-zA-Z_][a-zA-Z0-9_]*) < 99:\n \1 = 99 *$ | |
Write an if statement that tests whether a first variable is greater than a second variable. If the test passes, make the second variable equal to the first variable. Make up the variable names. | if first_amount > second_amount: second_amount = first_amount | ^ *if ([a-zA-Z_][a-zA-Z0-9_]*) > ([a-zA-Z_][a-zA-Z0-9_]*):\n \2 = \1 *$ | |
| 71125ff328 | ||
| 19344c5eb6 |