# Function - largest number in a list
def fnMax(L):
return max(L)
L1 = eval(input("Enter a List of numbers : "))
print("Largest number in given List = ", fnMax(L1))
# Function - largest number in a list
def fnMax(L):
return max(L)
L1 = eval(input("Enter a List of numbers : "))
print("Largest number in given List = ", fnMax(L1))
# Functions - Area of a shape
# Function overloading
"""
install multipledispatch as below from command prompt
pip install multipledispatch
"""
from multipledispatch import dispatch
@dispatch(int)
def fnShape(x):
print("Area of square = ",(x*x))
@dispatch(float)
def fnShape(x):
print("Area of circle = ",(3.142*x*x))
@dispatch(int,int)
def fnShape(x,y):
print("Area of rectangle = ",(x*y))
# The three function calls differ by number and datatype
fnShape(5) # int
fnShape(2.1) # float
fnShape(5,6) # int,int