Write expressions to compute the following.
age
indicates a teenager
year
indicates a leap yearGiven that a is assigned the value 3, what do the following expressions return, if anything?
True and False
b = (a != 3)
0.3 == (0.1 + 0.2)
Write a program that reads an integer from the user - 0, 1, 2 - and returns the corresponding name – “zero”, “one” or “other”.
If this feels a bit tricky, try implementing a solution for “one” and “other” first, and then add support for “two”.
Write a program that inputs three integers from the user and prints the largest. Don’t use a list max to solve this problem.
If this feels a bit tricky, try implementing a solution for only two integers and then adding support for the third integer as time allows.
If this seems too easy, try printing the three integers in ascending order (without using list sort).
Write a program that prints the appropriate plan cost based on
values of months
and plan
, and the
following table.
months plan 1 2-6 7+ silver $90 $60 $60 gold $90 $70 $35
For example, a 1-month (month == 1
), silver plan (plan
== 'silver'
) is $90.