lesson_1_ex_1_19_20

a=input(“Dose to a:”); b=input(“Dose to b:”); c=input(“Dose to c:”); D=b^2-4*a*c if D>0 x1=(-b+sqrt(D))/2*a x2=(-b-sqrt(D))/2*a k=sprintf(“Oi luseis einai x1= %f kai x2=%f”,x1,x2); disp(k) elseif D==0 x=-b/2*a k=sprintf(“I lusi einai x= %f”,x); disp(k) else disp(“Den exei pragmatikes luseis”) endif

Posted in Uncategorized

lesson_13_ex_2_17_18

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

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)

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)

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