def split_data(data, prob):
 results = ([], [])
 for row in data:
  results[(0 if (random.random() < prob) else 1)].append(row)
 return results

def split_data ( data , prob ) : results = ( [ ] , [ ] ) for row in data : results [ ( 0 if ( random . random ( ) < prob ) else 1 ) ] . append ( row ) return results
split data into fractions [prob .