Blog Archives

lesson_13_ex_2_17_18

def bathmologia(agwnes): scores = {} for i in agwnes: print i tl=i.split(“: “) tl1=tl[0].split(“-“) print tl , tl1 if tl1[0] not in scores: scores[tl1[0]]=0 if tl1[1] not in scores: scores[tl1[1]]=0 tl2=tl[1].split(“-“) if int(tl2[0]) > int(tl2[1]): scores[tl1[0]] += 3 elif int(tl2[0])

Posted in Uncategorized

lesson_13_ex_1_17_18

import pylab import numpy x = numpy.linspace(-15,15,100) y = x**5 + 24*x**2 – 100 + numpy.log(x) pylab.plot(x,y) pylab.show()  

Posted in Uncategorized

lesson_12_ex_2_17_18

def Fibo(n): if n == 1 or n == 2: return 1 else: l = [1,1] for i in range(2 , n): l.append(l[i-1] + l[i-2]) return l[-1] print Fibo(10) def Ribo(n): if n == 1: return 6 else: l =

Posted in Uncategorized

lesson_12_ex_1_17_18

def my_primes(x): counter = 0 i = 2 while (i <= x – 1): if x % i == 0: return ‘no’ i += 1 return ‘yes’ print my_primes(2), my_primes(1), my_primes(3)  

Posted in Uncategorized

lesson_11_ex_3_17_18

# -*- coding: utf-8 -*- “”” Created on Thu May 31 18:23:16 2018 @author: stkarlos “”” def discrete_maths(start , stop , show = False): k = [] for i in range(start , stop + 1): j = str(i) if (int(j[0])

Posted in Uncategorized

lesson_11_ex_2_17_18

# -*- coding: utf-8 -*- “”” Created on Thu May 31 18:13:54 2018 @author: stkarlos “”” def discrete_maths(start , stop , show = False): k = [] for i in range(start , stop + 1): j = str(i) if (int(j[0])

Posted in Uncategorized

lesson_11_ex_1_17_18

# -*- coding: utf-8 -*- “”” Created on Thu May 31 18:03:54 2018 @author: stkarlos “”” def discrete_maths(start , stop , query , multiple = ‘None’ , show = False): k = [] if multiple != ‘None’: for i in

Posted in Uncategorized

homewor_unsolved_defs_17_18

# write a def that takes 3 arguments: a start number (int), a stop number (int) and a boolean variable, called as flag, which would take either # True value or False. Its operation would be to produce all the

Posted in Uncategorized

lesson_10_ex_3_17_18

# -*- coding: utf-8 -*- “”” Created on Thu May 17 16:00:59 2018 @author: stkarlos “”” def list_list(r): k = [] #for i in range(0, len(r)): for i in r: s = 0 #for j in range(0, len(r[i])): for j

Posted in Uncategorized

lesson_10_ex_2_17_18

# -*- coding: utf-8 -*- “”” Created on Mon May 14 17:12:13 2018 @author: stkarlos “”” def ask1(n): t = [] z = [] for i in range(0,len(n)): if (n[i] % 2 == 0) : t.append(i) z.append(n[i]) return t ,

Posted in Uncategorized