Complete the code to read a WAV file using scipy.
from scipy.io import wavfile sample_rate, data = wavfile.[1]('audio.wav')
The wavfile.read function reads a WAV file and returns the sample rate and data array.
Complete the code to write data to a WAV file using scipy.
from scipy.io import wavfile wavfile.[1]('output.wav', sample_rate, data)
The wavfile.write function saves audio data to a WAV file with a given sample rate.
Fix the error in the code to correctly read a WAV file and print its sample rate.
from scipy.io import wavfile sample_rate, data = wavfile.read('sound.wav') print([1])
To print the sample rate, use the variable sample_rate which stores it after reading the file.
Fill both blanks to create a dictionary with word lengths for words longer than 3 letters.
words = ['sound', 'wav', 'file', 'data', 'io'] lengths = {word: [1] for word in words if len(word) [2] 3}
< instead of greater than >This dictionary comprehension stores the length of each word only if the word length is greater than 3.
Fill all three blanks to create a dictionary with uppercase keys and values filtered by positive numbers.
data = {'a': 1, 'b': -2, 'c': 3}
result = { [1]: [2] for k, v in data.items() if v [3] 0 }This dictionary comprehension creates keys as uppercase letters and includes only items with positive values.