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 , len(l)): #l:
  if (l[j] % 3 == 0) and (l[j] % 2 == 0):
    m.append(l[j])
  else:
    n.append(l[j])
print ' copy of l is: ', m
print ' the rest numbers are placed in: ', n

m1 = []
for i in range(0, len(m) - 1):
  r = (m[i] + m[i+1]) / 2.
  m1.append(m[i])
  m1.append(r)
m1.append(m[-1])
print m1

if len(l) % 2 == 0:
  t = len(l) / 2
else:
  t = len(l) / 2 + 1

k = []
for i in range(0, t):
  r = l[i] * l[len(l) - 1 - i]
  k.append(r)
print k


pentades = []
j = 0
while j <= len(l1) - 4:
  pentades.append(sum(l1[j:j+5]))
  j += 5


lista = []
for i in range(0,len(l1)):
  lista.append(l1[i])
print 'antigrafo tis l1: ' , lista

bp23 = 0
for i in range(5,len(l1) + len(pentades),6):
  lista.insert(i,pentades[bp23])
  bp23 += 1

 

Posted in Uncategorized