Write Python expressions for each of the following a Determi
Write Python expressions for each of the following:
a. Determine if n, an integer, is between 50 and 75 exclusively.
b. Determine if n, an integer, is greater or equal to 70, but less than 80.
c. Determine if n, an integer, is even.
d. Determine if n, an integer, is divisible by 4.
e. Determine if n, an integer, is divisible by 4 or 3, but not both.
Solution
Question a:
if n >=50 and n <= 75:
print \"n is between 50 and 75 exclusively.\"
Question b:
if n >=70 and n <80:
print \"n is greater or equal to 70, but less than 80.\"
Question c:
if n % 2 == 0:
print \"n is an even\"
Question a:
if n % 4 == 0:
print \"n is divisible by 4\"
Question e:
if (n % 4 == 0 or n % == 3) and not(n % 4 == 0 and n % == 3):
print \"n is divisible by 4 or 3, but not both\"
