Complete the code to calculate the even part of the signal x.
import numpy as np def even_part(x): return 0.5 * (x + x[1][::-1]) signal = np.array([1, 2, 3, 4, 5]) even = even_part(signal) print(even)
Complete the code to calculate the odd part of the signal x.
import numpy as np def odd_part(x): return 0.5 * (x [1] x[::-1]) signal = np.array([1, 2, 3, 4, 5]) odd = odd_part(signal) print(odd)
Fix the error in the code to correctly compute the even part of the signal.
import numpy as np def even_part(x): return 0.5 * (x [1] x[::-1]) signal = np.array([1, 2, 3, 4, 5]) even = even_part(signal) print(even)
Fill both blanks to create a dictionary comprehension that maps each element to its even or odd part based on index.
signal = [1, 2, 3, 4, 5] result = {i: 0.5 * (signal[i] [1] signal[-i-1]) for i in range(len(signal)) if i [2] 2 == 0} print(result)
Fill all three blanks to create a dictionary comprehension that maps each index to the odd part if index is odd, else even part.
signal = [1, 2, 3, 4, 5] result = {i: 0.5 * (signal[i] [1] signal[-i-1]) for i in range(len(signal)) if i [2] 2 [3] 1} print(result)
