All problems
Nyquist Sampling Rate
Problem
The Nyquist-Shannon sampling theorem requires sampling above twice the highest frequency present in the signal.
Given a list of frequencies in Hz, return the Nyquist rate 2 * max(freqs), or 0.0 for an empty list.
Hint
Only the highest frequency component determines the required rate.
Test cases
case 1
in: [[10]]
expected: 20
case 2
in: [[1,5,3]]
expected: 10
case 3
in: [[]]
expected: 0
case 4
in: [[0.5]]
expected: 1
Starter codePython
def nyquist_rate(freqs):
# Your code here
pass4 test cases · run your code against them in the editor