## This problem has been solved!

# Complete the function listmodn that, given an input list alist, an input value n, and an input index i, will attempt perform the modulo n operation on the i-th element of alist and return this value. Using try/except/else, the function should handle ZeroDivisionError and IndexError exceptions. If a ZeroDivisionError occurs, the function should return: float('Inf'). If an IndexError occurs, the

Complete the function listmodn that, given an input list alist, an input value n, and an input index i, will attempt perform the modulo n operation on the i-th element of alist and return this value. Using try/except/else, the function should handle ZeroDivisionError and IndexError exceptions.

If a ZeroDivisionError occurs, the function should return: float('Inf').

If an IndexError occurs, the function should return: float('Nan').

If no error occurs, the function will return the i-th element of alist taken modulo n.

For example:

a=[10,20,30,40,50,60,70,80,90]

print(listmodn(a,5,11))

would return a value of 5, but

a=[10,20,30,40,50,60,70,80,90]

print(listmodn(a,20,3))

would return a value of Inf.

**Related Book For**

## An Introduction to Measure Theoretic Probability

2nd edition

Authors: George G. Roussas

ISBN: 978-0128000427