Processing math: 100%
< Back

Lab 21: Sounds


Practice Problem 1

Write a function called average_list(a_list), which takes a list of integers as a parameter. Your function should print the average of the input grades.

Example

>>> average_list([0, 1, 2])
1.0
>>> average_list([1, 1, 1, 1, 1, 1])
1.0
>>> average_list([2, 4, 6, 8])
5.0

Hint


Practice Problem 2

Write a function called print_evens(a_list), which takes as a parameter a list of integers. Your function should print only the even values in the list.

Example

>>> print_evens([0, 1, 2, 3, 4, 5])
0
2
4
>>> print_evens([2, 1, 2, 3, 2, 4, 2])
2
2
2
4
2
>>> print_evens([1, 3, 4, 7, 9, 11, 13])
>>>

Hint


Reverse Sound

In a file called reverse_sound.py write a function called reverse(a_sound). This function should modify the passed in sound to play backwards.

Example

Before

Nato Phonetic Alphabet Normal

After

Nato Phonetic Alphabet Reversed

Hint