homework_on_defs_unsolved

# -*- coding: utf-8 -*-
"""
fill up with the appropriate code the non completed lines
@authors: katkaranikola stkarlos
"""

# write a def that returns a list with the indices of the inserted list 
# that contains items which are even

def ask1(n):

  return t

print ask1([2,3,4,11,234,567,-33,8])  #should print [0,2,4,7]

# write a def that returns two lists, the first with the items of the inserted list with indices smaller than num 
# and the second with the rest indices. If the num is larger than the length of l, an appropriate error message
# should appear and two empy lists to be returned

def ask2(n,num): 

  return l1, l2

a , k = ask2([1,5,'a',4,'123',-67.5,23] , 3)
print a, k # should print [1,5] , ['a',4,'123',-67.5,23]
a , k = ask2([1,5,'a',4,'123',-67.5,23] , 15)
print a, k # should print [] , [] and an error message 

#write a def that takes two arguments:i) the number of dices that are going to be used and ii) the number of iterations that
# our experiment is going to be played. It returns a list with the sum of the dices that are used per each iteration.
import random
#random.randint(1,6) - > returns a random integer from [1,6]
def ask3(dices, iter):

  return l

print ask3(2,5) #should return somethling like [10,3,6,4,12,]

 

Posted in Uncategorized