Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # дз по итератору
- cards = []
- for i in ('Пики','Буби','Черви','Крести'):
- for j in '6789jqka':
- cards.append(i + ' ' + j)
- iterator = iter(cards)
- for i in range(36):
- print(next(iterator))
- # лямбда
- from functools import reduce
- lenarray = int(input())
- array = []
- for i in range(lenarray):
- array += [int(input())]
- res = list(filter(lambda x: (x ** 2) % 9 == 0, array))
- ans = reduce(lambda x, y: x if x > y else y,res)
- print(ans)
- # дз по f строкам
- ip = [int(input()) for i in range(4)]
- a, b, c, d = ip
- for temp in ["{:08b}.", "{:b}.", "{:o}.", "{}.", "{:x}."]:
- print((temp * 4)[:-1].format(a, b, c, d))
- # дз по файлам
- #6
- def allstfile(namefile):
- with open(namefile,'r') as f:
- a = []
- for line in f:
- a += [line.rstrip("\n")]
- endstring = " "
- for i in range(len(a)):
- endstring += a[i] + ' '
- return endstring
- # 8
- def stringclean(string):
- return string.strip("!?.")
- #14
- def information(name):
- dictionary = {}
- with open(name,"r",encoding="utf-8") as f:
- base = f.readlines()
- for line in base:
- L = line.split()
- if L[2].isdigit():
- dictionary[L[0]] = (L[1],L[2])
- return dictionary
Advertisement
Add Comment
Please, Sign In to add comment