lis1 = ['name', 'sex', 'age', 'salary']
res = []
with open('xz.txt', 'r', encoding='utf-8')as fr:
for line in fr:
line = line.strip()
lis = line.split()
dic = {k: v for k, v in zip(lis1, lis)}
res.append((dic))
res1 = res
print(res1)
res2 = max(res1, key=lambda salary: salary['salary'])
print(res2)
res3 = min(res1, key=lambda age: age['age'])
print(res3)
res4 = map(lambda name: name['name'].title(), res1)
print(list(res4))
res5 = filter(lambda info: not info['name'].startswith('a'), res1)
print(list(res5))
def fb(n, n1=-1, n2=1):
n3 = n1 + n2
print(n3)
while n > 1:
n -= 1
fb(n, n2, n3)
return
fb(8)
l=[1,2,[3,[4,5,6,[7,8,[9,10,[11,12,13,[14,15]]]]]]]
def func1(l):
while len(l) == 0:
return
if not isinstance(l[0],list):
print(l[0])
func1(l[1:])
else:
func1(l[0])
func1(l[1:])
func1(l)