#python #anaconda #jupyter-notebook #visual-code #html #css #javascript #http

제목Quiz4 풀이 한번 올려봅니다..2019-12-02 16:41
작성자

비록 퀴즈 시간에는 시간이 부족해서 다 못풀었지만 아쉬운 마음에 제가 풀었던 코드 올려봅니다..


class AdvList(list):

    def removeAll(self,value):

        while(super().count(value)>0):

            super().remove(value)

                

    def replace(self,old,new,cnt):

        if cnt==-1:

            while(super().count(old)>0):

                self[super().index(old)] = new

        else:

            while(cnt>0 and super().count(old)>0):

                self[super().index(old)] = new

                cnt -=1

댓글
이전quiz42019-12-03
다음퀴즈4관련 질문드립니다.2019-12-02