|
@@ -0,0 +1,346 @@
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# from string import ascii_lowercase
|
|
|
+
|
|
|
+# d = {ascii_lowercase[i]: i + 1 for i in range(len(ascii_lowercase))}
|
|
|
+# print(d)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# my_dict = {1: "one", 2: "two"}
|
|
|
+# d1 = {'a': 100, 'b': 200, 'c': 333}
|
|
|
+# d2 = {'x': 300, 'y': 200, 'z': 777}
|
|
|
+
|
|
|
+# print(type(my_dict.items()))
|
|
|
+
|
|
|
+# for i in my_dict.items():
|
|
|
+# print(i[0], i[1])
|
|
|
+
|
|
|
+# d2.update(d1)
|
|
|
+# print(d2)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# n = int(input())
|
|
|
+# d = {}
|
|
|
+
|
|
|
+# for i in range(n):
|
|
|
+# name = input()
|
|
|
+# if name not in d:
|
|
|
+# d[name] = 0
|
|
|
+# print('OK')
|
|
|
+# else:
|
|
|
+# d[name] += 1
|
|
|
+# print(name + str(d[name]))
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+# countries = {
|
|
|
+# "Sweden": ["Stockholm", "Göteborg", "Malmö"],
|
|
|
+# "Norway": ["Oslo", "Bergen", "Trondheim"],
|
|
|
+# "England": ["London", "Birmingham", "Manchester"],
|
|
|
+# "Germany": ["Berlin", "Hamburg", "Munich"],
|
|
|
+# "France": ["Paris", "Marseille", "Toulouse"]
|
|
|
+# }
|
|
|
+
|
|
|
+# city = input()
|
|
|
+# flag = False
|
|
|
+
|
|
|
+# for key in countries.keys():
|
|
|
+# if city in countries[key]:
|
|
|
+# print(f'INFO: {city} is a city in {key}')
|
|
|
+# flag = True
|
|
|
+
|
|
|
+# if flag == False:
|
|
|
+# print(f'ERROR: Country for {city} not found')
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# from pprint import pprint
|
|
|
+
|
|
|
+# user = {
|
|
|
+# "id": 4170,
|
|
|
+# "uid": "5e941db5-9e0f-4f94-9fc5-734110c6be14",
|
|
|
+# "password": "SyUpfo1ljm",
|
|
|
+# "first_name": "Teresa",
|
|
|
+# "last_name": "Wehner",
|
|
|
+# "username": "teresa.wehner",
|
|
|
+# "email": "teresa.wehner@email.com",
|
|
|
+# "gender": "Non-binary",
|
|
|
+# "phone_number": "+674 424.561.2776",
|
|
|
+# "social_insurance_number": "637316241",
|
|
|
+# "date_of_birth": "1993-08-17"
|
|
|
+# }
|
|
|
+
|
|
|
+# user['secret'] = user.pop('password')
|
|
|
+# user['surname'] = user.pop('last_name')
|
|
|
+# pprint(user)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# l = list(map(int, input().split()))
|
|
|
+
|
|
|
+# d = {}
|
|
|
+# cnt = -3
|
|
|
+# for i in range(len(l) - 1):
|
|
|
+# if len(d) == 0:
|
|
|
+# d = {l[-2]:l[-1]}
|
|
|
+# else:
|
|
|
+# d = {l[cnt]:d}
|
|
|
+# cnt -= 1
|
|
|
+
|
|
|
+# print(d)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# s = 'waejskldcnvawefigas,dfaswe'
|
|
|
+# d = {}
|
|
|
+# for i in s:
|
|
|
+# if i.isalpha():
|
|
|
+# d[i] = d.get(i, 0) + 1
|
|
|
+
|
|
|
+# print(d)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# workers = {
|
|
|
+# 'employer1': {'name': 'Jhon', 'salary': 7500},
|
|
|
+# 'employer2': {'name': 'Emma', 'salary': 8000},
|
|
|
+# 'employer3': {'name': 'Brad', 'salary': 500}
|
|
|
+# }
|
|
|
+
|
|
|
+# workers['employer3']['salary'] = 8500
|
|
|
+# print(workers)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# supermarket = {
|
|
|
+# "milk": {"quantity": 20, "price": 1.19},
|
|
|
+# "biscuits": {"quantity": 32, "price": 1.45},
|
|
|
+# "butter": {"quantity": 20, "price": 2.29},
|
|
|
+# "cheese": {"quantity": 15, "price": 1.90},
|
|
|
+# "bread": {"quantity": 15, "price": 2.59},
|
|
|
+# "cookies": {"quantity": 20, "price": 4.99},
|
|
|
+# "yogurt": {"quantity": 18, "price": 3.65},
|
|
|
+# "apples": {"quantity": 35, "price": 3.15},
|
|
|
+# "oranges": {"quantity": 40, "price": 0.99},
|
|
|
+# "bananas": {"quantity": 23, "price": 1.29}
|
|
|
+# }
|
|
|
+
|
|
|
+# sum = 0
|
|
|
+
|
|
|
+# for i in supermarket.keys():
|
|
|
+# sum += supermarket[i]['quantity'] * supermarket[i]['price']
|
|
|
+
|
|
|
+# print(sum)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# Сколько раз встречается каждая буква
|
|
|
+# s = input().lower()
|
|
|
+# d = {}
|
|
|
+# for i in s:
|
|
|
+# if i.isalpha():
|
|
|
+# d[i] = d.get(i, 0) + 1
|
|
|
+
|
|
|
+# print(d)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# morze = {'a': '•—', 'b': '—•••', 'c': '—•—•', 'd': '—••',
|
|
|
+# 'e': '•', 'f': '••—•', 'g': '——•', 'h': '••••',
|
|
|
+# 'i': '••', 'j': '•———', 'k': '—•—', 'l': '•—••',
|
|
|
+# 'm': '——', 'n': '—•', 'o': '———', 'p': '•——•',
|
|
|
+# 'q': '——•—', 'r': '•—•', 's': '•••', 't': '—',
|
|
|
+# 'u': '••—', 'v': '•••—', 'w': '•——', 'x': '—••—',
|
|
|
+# 'y': '—•——', 'z': '——••'}
|
|
|
+
|
|
|
+# l = list(input().split())
|
|
|
+# for i in l:
|
|
|
+# for j in i:
|
|
|
+# print(morze[j.lower()], end=' ')
|
|
|
+# print()
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# {
|
|
|
+# 'Bob Moore': {
|
|
|
+# 'salary': 330000,
|
|
|
+# 'gender': 'M',
|
|
|
+# 'passport': '1635777202'
|
|
|
+# },
|
|
|
+# 'Gina Moore': {
|
|
|
+# 'salary': 12500,
|
|
|
+# 'gender': 'F',
|
|
|
+# 'passport': '1639999999'
|
|
|
+# }
|
|
|
+# }
|
|
|
+
|
|
|
+# persons= [
|
|
|
+# ('Allison Hill', 334053, 'M', '1635644202'),
|
|
|
+# ('Megan Mcclain', 191161, 'F', '2101101595'),
|
|
|
+# ('Brandon Hall', 731262, 'M', '6054749119'),
|
|
|
+# ('Michelle Miles', 539898, 'M', '1355368461'),
|
|
|
+# ('Donald Booth', 895667, 'M', '7736670978'),
|
|
|
+# ('Gina Moore', 900581, 'F', '7018476624'),
|
|
|
+# ('James Howard', 460663, 'F', '5461900982'),
|
|
|
+# ('Monica Herrera', 496922, 'M', '2955495768'),
|
|
|
+# ('Sandra Montgomery', 479201, 'M', '5111859731'),
|
|
|
+# ('Amber Perez', 403445, 'M', '0602870126')
|
|
|
+# ]
|
|
|
+
|
|
|
+# data = {}
|
|
|
+
|
|
|
+# for i in persons:
|
|
|
+# data[i[0]] = {'salary': i[1], 'gender': i[2], 'passport': i[3]}
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# from pprint import pprint
|
|
|
+
|
|
|
+# data = {
|
|
|
+# "my_friends": {
|
|
|
+# "count": 10,
|
|
|
+# "people": [{
|
|
|
+# "first_name": "Kurt",
|
|
|
+# "id": 621547005,
|
|
|
+# "last_name": "Cobain",
|
|
|
+# "bdate": "31.8.2005"
|
|
|
+# }, {
|
|
|
+# "first_name": "Виолетта",
|
|
|
+# "id": 484200150,
|
|
|
+# "last_name": "Кастилио",
|
|
|
+# }, {
|
|
|
+# "first_name": "Иринка",
|
|
|
+# "id": 21886133,
|
|
|
+# "last_name": "Бушуева",
|
|
|
+# "bdate": "28.8.1942"
|
|
|
+# }, {
|
|
|
+# "first_name": "Данил",
|
|
|
+# "id": 282456573,
|
|
|
+# "last_name": "Греков",
|
|
|
+# "bdate": "4.7.2002"
|
|
|
+# }, {
|
|
|
+# "first_name": "Валентин",
|
|
|
+# "id": 184902932,
|
|
|
+# "last_name": "Долматов",
|
|
|
+# "bdate": "25.5"
|
|
|
+# }, {
|
|
|
+# "first_name": "Евгений",
|
|
|
+# "id": 620469646,
|
|
|
+# "last_name": "Шапорин",
|
|
|
+# "bdate": "6.12.1982"
|
|
|
+# }, {
|
|
|
+# "first_name": "Ангелина",
|
|
|
+# "id": 622328862,
|
|
|
+# "last_name": "Краснова",
|
|
|
+# "bdate": "4.11.1995"
|
|
|
+# }, {
|
|
|
+# "first_name": "Иван",
|
|
|
+# "id": 576015198,
|
|
|
+# "last_name": "Вирин",
|
|
|
+# "bdate": "2.2.1915"
|
|
|
+# }, {
|
|
|
+# "first_name": "Паша",
|
|
|
+# "id": 386922406,
|
|
|
+# "last_name": "Воронов",
|
|
|
+# "bdate": "27.9"
|
|
|
+# }, {
|
|
|
+# "first_name": "Ольга",
|
|
|
+# "id": 622170942,
|
|
|
+# "last_name": "Савченкова",
|
|
|
+# "bdate": "20.12"
|
|
|
+# }]
|
|
|
+# }
|
|
|
+# }
|
|
|
+
|
|
|
+# l = data.get('my_friends').get('people')
|
|
|
+# my_list = []
|
|
|
+
|
|
|
+# for i in l:
|
|
|
+# my_list.append(i.get('first_name'))
|
|
|
+
|
|
|
+# my_list.sort()
|
|
|
+
|
|
|
+# for i in my_list:
|
|
|
+# print(i)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# user = {
|
|
|
+# "id": 4170,
|
|
|
+# "uid": "5e941db5-9e0f-4f94-9fc5-734110c6be14",
|
|
|
+# "password": "SyUpfo1ljm",
|
|
|
+# "first_name": "Teresa",
|
|
|
+# "last_name": "Wehner",
|
|
|
+# "username": "teresa.wehner",
|
|
|
+# "email": "teresa.wehner@email.com",
|
|
|
+# "gender": "Non-binary",
|
|
|
+# "phone_number": "+674 424.561.2776",
|
|
|
+# "social_insurance_number": "637316241",
|
|
|
+# "date_of_birth": "1993-08-17",
|
|
|
+# "employment": {
|
|
|
+# "title": "Central Hospitality Liaison",
|
|
|
+# "key_skill": "Organisation"
|
|
|
+# },
|
|
|
+# "subscription": {
|
|
|
+# "plan": "Essential",
|
|
|
+# "status": "Idle",
|
|
|
+# "payment_method": "Debit card",
|
|
|
+# "term": "Annual"
|
|
|
+# }
|
|
|
+# }
|
|
|
+
|
|
|
+# keys = list(input().split())
|
|
|
+# my_dict = {i:user.get(i) for i in keys}
|
|
|
+# print(my_dict)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# people = [
|
|
|
+# ['Amy Smith', '694.322.8133x22426'],
|
|
|
+# ['Brian Shaw', '593.662.5217x338'],
|
|
|
+# ['Christian Sharp', '118.197.8810'],
|
|
|
+# ['Sean Schmidt', '9722527521'],
|
|
|
+# ['Thomas Long', '163.814.9938'],
|
|
|
+# ['Joshua Willis', '+1-978-530-6971x601'],
|
|
|
+# ['Ann Hoffman', '434.104.4302'],
|
|
|
+# ['John Leonard', '(956)182-8435'],
|
|
|
+# ['Daniel Ross', '870-365-8303x416'],
|
|
|
+# ['Jacqueline Moon', '+1-757-865-4488x652'],
|
|
|
+# ['Gregory Baker', '705-576-1122'],
|
|
|
+# ['Michael Spencer', '(922)816-0599x7007'],
|
|
|
+# ['Austin Vazquez', '399-813-8599'],
|
|
|
+# ['Chad Delgado', '979.908.8506x886'],
|
|
|
+# ['Jonathan Gilbert', '9577853541']
|
|
|
+# ]
|
|
|
+
|
|
|
+# phone_book = {i[1]: i[0] for i in people}
|
|
|
+# print(phone_book)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+# from random import randint
|
|
|
+
|
|
|
+# n = 5
|
|
|
+# m = 3
|
|
|
+
|
|
|
+# a = [[randint(1, 6) for j in range(m)] for i in range(n)]
|
|
|
+# for i in a:
|
|
|
+# print(i)
|
|
|
+
|
|
|
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+
|
|
|
+from random import randint
|
|
|
+
|
|
|
+n = 5
|
|
|
+m = 5
|
|
|
+
|
|
|
+a = [[randint(1, 6) for j in range(m)] for i in range(n)]
|
|
|
+for i in a:
|
|
|
+ print(i)
|
|
|
+
|
|
|
+b = [a[i][j] for j in range(n) for i in range(m) if i == j]
|
|
|
+print('Main diag: ', b)
|