Question: Using Python tutor 4. Write Python code to satisfy the following conditions. Then test your code on the values of the variables given. (a) Given
Using Python tutor4. Write Python code to satisfy the following conditions. Then test your code on the values of the variables given. (a) Given an int n, return the absolute difference between n and 21, except return double the absolute difference if n is over 21. It should return 2 when n=19. It should return 11 when n=10. What will the code return when n=21 or n=257 (b) We have a loud talking parrot. The "hour" parameter is the current hour time in the range 0.23. We are in trouble if the parrot is talking and the hour is before 7 or after 20. Return True if we are in trouble. It should return True when the parrot is talking and the hour is 6. It should return false when the parrot is not talking and the hour is 6. What does it return if the parrot is talking and the hour is 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
