Instructions: Create an object of type DataAnalyzer with th…

Instructions: Create an object of type DataAnalyzer with the given data. After creating the object, call the get_stats method, store the result in a variable called stats, and then print stats. Print the DataAnalyzer object to see its string representation. Enter the expected outputs from step 2 and 3. Given: # Data Analyzer class DataAnalyzer(object): def __init__(self, data): self.data = data def get_stats(self): a = min(self.data) b = max(self.data) c = sum(self.data)/len(self.data) return (a, b, c) def __str__(self): return f”DataAnalyzer with data: {self.data}” # Input data data = [2, 6, 4, 4]

In wireless communications, maintaining sufficient signal st…

In wireless communications, maintaining sufficient signal strength is essential for a stable connection. You are tasked with simulating a network connection process where weak signal strength should raise an exception. Define a custom exception class called WeakSignalError that inherits from Exception. Set the default error message to “Weak signal detected”. Write a function connect_to_network(signal_strength): If the signal strength is less than 40, the function should raise the WeakSignalError. If the signal strength is 40 or greater, the function should print “Connection successful.” Write a try-except block that: Calls connect_to_network with a test signal_strength value (you can choose any value). Catches and handles the WeakSignalError exception by printing the exception message.