# 20.12. Write Code Questions¶

1. Create a subclass of the Parent class named Child that overrides the inherited eye_color() method to return "I have green eyes."

2. Create a subclass of the Greeter class named GrumpyGreeter that overrides the inherited greet method to return "Go Away!".

3. Create a subclass of the Animal class named Cow that overrides the inherited noise method to return "Moo".

4. Create a subclass of the Actor class named OverActor that overrides the inherited act method to return "I am super happy!".

5. Create a subclass of the Student class named GradStudent that calls the __init__ method in Student to initialize the first and last name and overrides the inherited fav_food method to return "Sushi".

6. Write a function is_ascending(nums) that returns True if the numbers in the list nums are sorted in ascending order and False otherwise. If the list nums has less than two numbers in it return True. For example, is_ascending([1,2,3]) should return True, is_ascending() should also return True, and is_ascending([3,2,1]) should return False.

7. Write a function sum_lists(l1,l2) that take two lists of numbers, l1 and l2 and returns a list with the sum of the corresponding items in l1 and l2. For example, sum_lists([1,2],[3,4]) would return [4,6]. If the two lists are of different length then returned list should be the same length as the shortest list. For example, sum_lists(,[4,3]) should return .

8. Write a function avg_pos(nums) that returns the average of the positive numbers in the list nums. For example, avg_pos([80, -20, 90]) should return 85.0.

9. Write a function quartile(value) that returns 0 if value is <= 0.25, 1 if value is > 0.25 and <= 0.5, 2 if value is > 0.5 and <= 0.75, and 3 if value > 0.75.

10. Fix the function dup_adjacent(nums) to return True if there are duplicate adjacent values in nums. For example, dup_adjacent([1,2,1]) should return False and dup_adjacent([4, 3, 3, 2]) should return True because of the adjacent 3’s. Return False if the length of the list is less than two.