Programming, Data Structures And Algorithms Using Python week -3 programming assignment solution 2021

 Programming, Data Structures And Algorithms Using Python week -3 programming assignment solution 2021

def remdup(l):

    for i in l:

        if l.count(i)>1:

            l.remove(i)

            remdup(l)

            return l

        else:

            return l

          

def splitsum(l): 

    pos=0

    neg=0

    for n in l:

        if n > 0:

            pos=pos+n**2

        else:

            neg=neg+n**3

    return [pos,neg]

        

def matrixflip(m, d):

    if d == 'v':

        return m[::-1]

    elif d == 'h':

        return [row[::-1] for row in m]

    else:

        return m[:]

No comments

Powered by Blogger.