By Datatypes Adding The Values || Polymorphism || Python

In this we are going to write a program By Datatypes Adding The Values in Python Programming Language.


def add(datatype, *args):
    if datatype == 'int':
        answer = 0
    if datatype == 'str':
        answer = ''
    for x in args:
        answer = answer + x

    print(answer)


add('int', 8, 6)
add('str', 'Hi ', 'HFC')

# Coded By Dhiraj Shelke

#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post