Arrays
Code
Diff
  • def return_numbers(list):
        return [int(i) for i in list if str(i).isnumeric()]
      
  • 1
    public class myWorld{
    
    2
      public static void printArray(int[] arr){
    
    3
        for(int i : arr)
    
    4
          System.out.println(i);
    
    5
      }
    
    6
    }
    
    1+
    def return_numbers(list):
    
    2+
        return [int(i) for i in list if str(i).isnumeric()]
    
    3+
      
    

Takes a string of an even length, splits it in two and intertwines those to generate the output string.
e.g intertwine('135246') --> '123456'
intertwine('11223344') --> '13132424'

def intertwine(text):
    return ''.join([val+'' for pair in zip(text[:len(text)//2], text[len(text)//2:]) for val in pair])