QUESTION

Text
Image

# Use python E1. Write a code fragment that checks if the integer stored in a variable $\mathrm{x}$ is divisible by 2 and, if so, print "Even"; otherwise, print "Odd". Write your own test cases to check the correctness of your code: one for an even value for $\mathrm{x}$, and one for an odd value of $\mathrm{x}$. $1 \quad 1 x=5$ E2. Write a code fragment that checks if the value stored in a variable $\mathrm{x}$ is divisible by 2 or 7 , and, if so, print "Divisible"; otherwise, print "Not divisible: Try the four test cases below to check the correctness of your code. [ $11 \mathbf{x}=5$ 1. $1 \mathrm{x}=4$ $1 \mathrm{x}=21$ $1 x=28$ E3. Write a code that checks if the string stored in a variable $x$ is at least 10 characters long and starts with the letter Q. If so, print "Pass"; otherwise, print "Fail", Write your own test cases to check the correctness of your code. $11 x=$ 'sBu' I $1 \mathrm{x}=$ 'sBu' E5. Write a code fragment that checks if the string stored in a variable $x$ starts with the letters $\mathrm{X}, \mathrm{Y}$ or $\mathrm{Z}$ and ends with the letter $\mathrm{A}$. If so, print "Pass"; otherwise, print "Fail". Write your own test cases to check the correctness of your code.  