Ad
Fundamentals
Code
Diff
  • def find_special(jar, special):
        k = []
        z = []
        if jar != None and jar != []:
            for i in jar: 
                if i == special: 
                    z.append(i)
                else: 
                    k.append(i)
            z.extend(k)
            return z
        else: 
            return None
    
        
            
        
    • def find_special(jar, special):
    • # initial solution
    • k = []
    • z = []
    • if jar != None and jar != []:
    • for i in range(len(jar)):
    • if jar[i] == special:
    • jar.insert(0,jar.pop(i))
    • break
    • return jar
    • return None
    • for i in jar:
    • if i == special:
    • z.append(i)
    • else:
    • k.append(i)
    • z.extend(k)
    • return z
    • else:
    • return None