0 out of 464 challenges solved
Write a Python function `max_val` that takes a heterogeneous list as input and returns the maximum integer value from the list. The list may contain elements of various data types, but only integer values should be considered for finding the maximum. #### Example Usage ```python [main.nopy] print(max_val(['Python', 3, 2, 4, 5, 'version'])) # Output: 5 print(max_val(['Python', 15, 20, 25])) # Output: 25 print(max_val(['Python', 30, 20, 40, 50])) # Output: 50 ``` #### Constraints - The input list will always contain at least one integer. - Non-integer elements should be ignored.
def max_val(listval): """ Find the maximum integer value in a heterogeneous list. Args: listval (list): A list containing elements of various data types. Returns: int: The maximum integer value in the list. """ # Filter the integers and find the maximum value pass # Replace this with your implementation