Ad
Arrays
Data Types
Code
Diff
  • def return_numbers(list):
        return [int(i) for i in list if str(i).isnumeric()]
      
    • public class myWorld{
    • public static void printArray(int[] arr){
    • for(int i : arr)
    • System.out.println(i);
    • }
    • }
    • def return_numbers(list):
    • return [int(i) for i in list if str(i).isnumeric()]

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])