Section 16.4 Write the Code
Checkpoint 16.4.2.
Write a function named
count_evens(numbers) that returns how many values in the list are even.
Checkpoint 16.4.3.
Write a function named
find_max(numbers)that returns the largest number in the list. Do not use max().
Checkpoint 16.4.4.
Write a function named
multiplication_table(n) that prints the multiplication table for n from 1 through 10.
Checkpoint 16.4.5.
Write a function named
count_passing(scores) that counts how many scores are greater than or equal to 70.
Checkpoint 16.4.6.
Write a function named
sum_greater_10(numbers) that computes the sum of numbers greater than 10.
Checkpoint 16.4.7.
Write code to print this pattern using a loop:
* ** *** **** *****
Checkpoint 16.4.8.
Write a function named f
first_duplicate(numbers) that returns the first number that appears more than once. Return None if there are no duplicates.
Checkpoint 16.4.9.
Write a function
sublist_until_target(numbers, target) that returns a list of elements before the first occurrence of target. If the target is not found, return the entire list.
Checkpoint 16.4.10.
Write a function count_words(text) that returns the number of words in the given text. Assume that words are separated by a single space.
Checkpoint 16.4.11.
Checkpoint 16.4.12.
Write a function censor_word(text) that returns a new string of the text where every occurrence of "bad" is replaced with "***". Do not modify the original string.
Checkpoint 16.4.13.
Write a function short_words(text) that takes string of text and returns a list of words with length β€ 3. Do not modify the original string.
Checkpoint 16.4.14.
Write a function contains_word(text, word) that returns True if the exact word appears in the text. Otherwise returns False.
You have attempted of activities on this page.
