ubuntu2004
Exercise 9.1
Say we have three variables,
x,yandzthat store decimal numbers.Write some code to test and print whether
yis betweenxandz.
Test your code on the following sets of numbers.
and
and
Exercise 9.2
Ask for input of a word.
Test and print whether either of the letters 'a' or 'e' are in the word.
Exercise 9.3
Ask for input of a DNA base (A, C, G, and T) in lower or upper case.
First test that the input is a single letter rather than no input or more than one letter. Hint: Use
len().If the test in Step 2 is True, next test if the letter entered is a valid base and not some other letter. Print whether the base is valid or not.
If the test in Step 2 is False print that the input is not a valid base.
Exercise 9.4
Ask for input of an integer number.
If that number is even (i.e., whether it is divisible by 2) print
Trueotherwise printFalse.
Exercise 9.5
Ask for input of a word.
If the letter "r" is in the word print
Trueotherwise printFalse