Blog Archives

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

lesson_6_ex_1_17_18

# -*- coding: utf-8 -*- “”” Created on Mon Apr 16 18:23:58 2018 @author: 07sta “”” #compute the S = 3*4*5 + 4*5*6 + … + 23*24*25 + 1896 s = 1896 for i in range(3,24): s = s +

Posted in Uncategorized

lesson_6_ex_2_17_18

# -*- coding: utf-8 -*- “”” Created on Mon Apr 16 18:23:58 2018 @author: stkarlos “”” #compute the sum S = 2^5 + 4^8 – 6^11 + 8^14 – … + 20^32 s = 2**5 j = 8 k =

Posted in Uncategorized

lesson_5_ex_3_17_18

# -*- coding: utf-8 -*- “”” Created on Mon Mar 26 18:47:34 2018 @author: stkarlos “”” x = raw_input(” dose 8psifio kodiko: “) if len(x) != 8: print ‘dose ksana’ elif x[0] != x[-1] or x.count(‘a’) != x.count(‘!’): print ‘lathos

Posted in Uncategorized

lesson_5_ex_2_17_18

# -*- coding: utf-8 -*- “”” Use of casting theory @authors: stkarlos “”” a = float(raw_input(‘dose to a: ‘)) b = float(raw_input(‘dose to b: ‘)) c = float(raw_input(‘dose to c: ‘)) if (a >= b) and (a >= c): M

Posted in Uncategorized

lesson_5_ex_1_17_18

# -*- coding: utf-8 -*- “”” Created on Thu Mar 29 16:18:18 2018 @author: stkarlos “”” a = ‘ARTERTaabntrur’ #metrame sinoliko plithos a and A print a.count(‘a’) + a.count(‘A’) #combinatory print (a.upper()).count(‘A’) #safe way print a.lower().count(‘a’) #directly  

Posted in Uncategorized

homework_lesson_4_17_18

# -*- coding: utf-8 -*- “”” Sibliroste tis grammes 15 eos 19 etsi oste stin print tis grammis 22 na emfanizontai oi theseis olon ton a @authors: stkarlos “”” #paradeigma xrisis tis print me ta % z = 5 print

Posted in Uncategorized