# Informatika2-2012/Gyakorlat08m

```#! /usr/bin/env python

# udvozlo
if __name__ == "__main__":
print 'Hello World!'

# udvozlo2
import sys

if __name__ == '__main__':
if len(sys.argv) > 1:
print "Hello {0}".format(sys.argv[1])

# lista 1
l = ['a','b','c','d']

def revL(l):
lc = l[:]
for i in range(1,len(lc)+1):
l[i-1] = lc[-i]
return l

print revL(l)

# lista 2
l1 = ['a','b','c','d']
l2 = [1,2,3,4]
def yip(l1, l2):
k = {}
for i in range(min(len(l1), len(l2))):
k[l1[i]] = l2[i]
return k

print yip(l1, l2)

# lista 3
l3 = [1,5,12,45]
l4 = [2,22,44,50]

def qs(l1, l2):
li = ri = 0
lmi = len(l1)
rmi = len(l2)
k = []
while True:
if li < lmi:
if ri < rmi:
if l1[li] > l2[ri]:
k.append(l2[ri])
ri += 1
else:
k.append(l1[li])
li += 1
else:
k.append(l1[li])
li += 1
else:
if ri < rmi:
k.append(l2[ri])
ri += 1
else:
break
return k

print qs(l3, l4)

# string1
def revS(s):
l = s[:]
t = ''
for i in range(1, len(l) + 1):
t += l[-i]
return t

print revS("akaraki")

# string2
def evS(s):
k = ''
for i in range(1, len(s), 2):
k += s[i]
return k

print evS('romkooss')

# string3
def incS(s):
for i in range(len(s)):
l = s[:i + 1]
print ''.join(l)

incS('almapaprika')```