CSE 160 Section 02 Solutions 1. words = ["hello", "world", "python", "yellow"] l_count = 0 for word in words: for letter in word: if letter == 'l': l_count = l_count + 1 print l_count 2. def over_twenty(ages): total = 0 for age in ages: if age > 20: total = total + 1 return total 3. def age_groups(ages): thirties = 0 twenties = 0 under_twenty = 0 for age in ages: if age >= 30: thirties = thirties + 1 elif age >= 20 twenties = twenties + 1 else under_twenty = under_twenty + 1 print thirties print twenties print under_twenty 4. def odd(num): if num % 2 == 1: return True else: return False 5. def avg_age(ages): total = 0 for age in ages: total = total + age avg = float(total) / len(ages) return avg 6. def max_height(class_lst): cur_max = 0 for student in class_lst: student_height = get_height(student) if(student_height > cur_max): cur_max = student_height return cur_max Type when returning: Int Type when printing: None