Assume choice references a string. The following if statement determines whether choice is equal to ‘Y’ or ‘y’: if choice == 'Y' or choice == 'y': Rewrite this statement so it only makes one comparison and does not use the or operator. (Hint: use either the upper or lower methods.)
2. Write a loop that counts the number of digits that appear in the string referenced by mystring.
3. Write a function that accepts a string as an argument and returns true if the argument ends with the substring ' .com '. Otherwise, the function should return false.
4. Write a function that accepts a string as an argument and displays the string backwards.
5. Assume mystring references a string. Write a statement that uses a slicing expression and displays the last 3 characters in the string.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |