Checkpoint 4.12.1.
Create code that sets the variable
result
equal to “x is less than 3” when x
is less than 3. Otherwise, set it to “All done”.result
equal to “x is less than 3” when x
is less than 3. Otherwise, set it to “All done”.x
to 2 and then sets the variable message
to “Hello” if x
is less than 2
, “Hey” if x
is greater than 2
, and “Hi” if x
is 2
.price
to 1.5 if weight
is less than 2, otherwise set price
to 1.3. Then, set total
to the weight
times price
. For example, if weight
is 0.5 then price
should be set to 1.5 and total
will be 0.75.number
to x is a number from 1 to 10
if the value of x is 1-10, x is a number less than 1
if the value of x is zero or below, and x is a number greater than 10
if the value of x is more than 10.rate
to the cost of a 14 mile cab ride. If the distance traveled is less than or equal to 12 miles, then rate
cost is $2.00 a mile, and if the distance traveled is more than 12 miles then rate
cost is $1.50 a mile. Assign the final cost to the variable total
.result
to determine whether a number is odd or even.