Blog Archives

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

lesson_7_ex_3_17_18

# -*- coding: utf-8 -*- “”” Created on Mon Apr 23 19:05:13 2018 @author: stkarlos “”” l = [5,11,22,9,7,11,10] s = 0 i = 0 while s <= 50: s = s + l[i] i = i + 1 print

Posted in Uncategorized

lesson_7_ex_2_17_18

# -*- coding: utf-8 -*- “”” Created on Mon Apr 23 18:03:54 2018 @author: stkarlos “”” l = [] for i in range(1,11): l.append(i**2) print l , sum(l) # new list m = [] for i in range(0,len(l)): m.append( l[i]

Posted in Uncategorized

lesson_7_ex_1_17_18

# -*- coding: utf-8 -*- “”” Created on Mon Apr 23 19:05:13 2018 @author: stkarlos “”” n = int(raw_input(‘dose arithmo: ‘)) P = 1 for i in range(1,n+1): P = P * i print P print ‘end for’ print ######

Posted in Uncategorized