lesson9_17_ear_3

# -*- coding: utf-8 -*-
"""
Examples of initializing a list with random numbers and processing it
@authors: katkaranikola stkarlos
"""
import random

def create_list(num):
    l = []
    for i in range(0,num):
        x = random.randint(1,15)
        l.append(x)
    print "your list is: " , l
    return l

def split_listas_by_criterion(l , limit):
    if type(l) != list or type(limit)!= int:
        return "wrong input"
    k = []
    t = []
    for i in range(0, len(l)):
        if l[i] > limit:
            k.append(l[i])
        else:
              t.append(l[i] ** 2)  
    return k , t


a , b = split_listas_by_criterion([2,3,5,7,-1,56] , 4)
print a
print b

lista = create_list(10)
c , d = split_listas_by_criterion( lista , 10)
print c
print d

 

Posted in Uncategorized