22b. List Exercises 6
More exercises using lists.
-
rep1: number(n) -> list of numbers
. Produce a list with the number 20
repeated n times.
(check-expect (rep1 5) (list 20 20 20 20 20))
-
rep2: number(n) -> list of numbers
. Produce a list with the
pattern 30 40
repeated n times.
(check-expect (rep2 3) (list 30 40 30 40 30 40))
-
rep3: number(n) -> list of numbers
. Produce a list of n numbers,
repeating the pattern 50 60. (But not n repetitions of the pattern!)
(check-expect (rep3 5) (list 50 60 50 60 50))
-
sqlist: list of numbers -> list of images
. Given a list of
numbers, produce a list of purple outline squares using the numbers
for side lengths.
-
drop-10s : list-of-numbers -> list-of-numbers
.
Get rid of all of the multiples of 10 from the list.
-
drop-10-plus : number(a) list-of-numbers -> list of numbers
.
Get rid of the number a as well as all multiples of 10.
-
rnglist: number(n) -> list-of-numbers
. Produce n values, randomly
chosen from the multiples of 10 between 20 and 120
(inclusive). That means the possibilties are 20, 30, 40, …, 100, 110, 120.
-
no35: list-of-numbers -> list-of-numbers
. Remove all of items
that are either 30 or 50. The output list should have everything
from the original list except 30s and 50s.