Blog Archives

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

lesson_10_ex_1_17_18

# -*- coding: utf-8 -*- “”” Created on Mon May 14 18:06:40 2018 @author: stkarlos “”” def hotel(days, cost , tax , dnt = ‘Yes’): if type(days) != int or type(cost) != float or type(tax) != int or type(dnt) !=

Posted in Uncategorized

lesson_9_ex_2_17_18

def ex1(x,y,z): #returns (x/y) ** z if y is not equalt to 0 k = -1 if y != 0: x = float(x) k = (x/y)**z else: print ‘Error’ return k def ex2(s,n): #returns the nth character of a given

Posted in Uncategorized

lesson_9_ex_1_17_18

s = 0 k = ” for i in range (9,0,-1): k = k + str(i) s = s + int(k) print ‘the last added number is ‘ , k print s vowels = ‘aeiough’ s = ” x =

Posted in Uncategorized

lesson_8_ex_4_17_18

x = raw_input(‘ dose password :’) while len(x)== 6 or x.count(‘!’) >= 2: print ‘ niose ligo psile mou’ x = raw_input(‘ ksana dose: ‘) print x  

Posted in Uncategorized

lesson_8_ex_3_17_18

m = [] for i in range(0, len(l1)): if (l[i] % 2 == 0) and (l[i] % 3 == 0): m.append(l[i]) print m k = [] #mesoi = [] for i in range(0, len(l1)): #mesoi.append( (l1[i] + l1[i+1]) / 2.

Posted in Uncategorized

lesson_8_ex_2_17_18

l1 = [] for i in range(1,31,2): l1.extend([i,i+1]) print l1 ### l2 = [] i = 1 while i <= 30: l2.append(i) i = i + 1 print l2 ### m = [] n = [] for j in range(0

Posted in Uncategorized

lesson_8_ex_1_17_18

l = [] flag = False while flag == False: x = raw_input(‘ dose tixaio arithmo : ‘) if x == ‘!’: flag = True else: l.append(float(x)) print l if len(l) % 2 == 0: Case = ‘even’ else: Case

Posted in Uncategorized