Processing math: 100%
< Back

Lab 20: Sounds


Practice Problem 1

Write a function called convert_to_GPA(alphabet_grade), which takes a string which contains just one character. This character must be one of "ABCDF". Your function should print the GPA associated for that grade:

Letter Grade Numeric Grade
A4.0
B3.0
C2.0
D1.0
F0.0

Example

>>> convert_to_GPA("A")
4.0
>>> convert_to_GPA("D")
1.0
>>> convert_to_GPA("F")
0.0

Hint


Practice Problem 2

Write a function called print_factors(x), which prints all of the positive integer factors of x. An integer y is an integer factor of x if the remainder of xy is 0.

Example

>>> print_factors(1)
1
>>> print_factors(2)
1
2
>>> print_factors(4)
1
2
4

Hint


Decrease Volume

In a file called decrease_volume.py write a function called decrease_volume(a_sound). This function should modify the passed in sound to be quieter than previous.

Example

Before

Nato Phonetic Alphabet Normal

After

Nato Phonetic Alphabet Quiet

Hint