Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- line_symbol = '1234567890-=qwertyuiop[]asdfghjkl;zxcvbnm,./~!@#$%^&*()_+QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?'
- def random_hex():
- result = ""
- for i in range(16):
- result += line_symbol[random.randint(0, len(line_symbol) - 1)]
- return result
- CHAR_HEX = {
- 'а': random_hex(),
- 'б': random_hex(),
- 'в': random_hex(),
- 'г': random_hex(),
- 'д': random_hex(),
- 'е': random_hex(),
- 'ё': random_hex(),
- 'ж': random_hex(),
- 'з': random_hex(),
- 'и': random_hex(),
- 'й': random_hex(),
- 'к': random_hex(),
- 'л': random_hex(),
- 'м': random_hex(),
- 'н': random_hex(),
- 'о': random_hex(),
- 'п': random_hex(),
- 'р': random_hex(),
- 'с': random_hex(),
- 'т': random_hex(),
- 'у': random_hex(),
- 'ф': random_hex(),
- 'х': random_hex(),
- 'ц': random_hex(),
- 'ч': random_hex(),
- 'ш': random_hex(),
- 'щ': random_hex(),
- 'ъ': random_hex(),
- 'ы': random_hex(),
- 'ь': random_hex(),
- 'э': random_hex(),
- 'ю': random_hex(),
- 'я': random_hex(),
- ' ': random_hex(),
- '1': random_hex(),
- '2': random_hex(),
- '3': random_hex(),
- '4': random_hex(),
- '5': random_hex(),
- '6': random_hex(),
- '7': random_hex(),
- '8': random_hex(),
- '9': random_hex(),
- '0': random_hex(),
- }
- def complite_to_hex(line):
- result = ""
- for char in str(line):
- result += CHAR_HEX.get(char)
- return result
- def value_for_dict(item):
- for key, value in CHAR_HEX.items():
- if value == item:
- return key
- return None
- def decode_hex(line):
- list_items = list(line)
- symbol = ''
- result = ''
- for index in range(len(list_items)):
- symbol += line[index]
- if len(symbol) == 16:
- result += value_for_dict(symbol)
- symbol = ''
- return result
- input_string = "привет приветствую"
- hex_result = complite_to_hex(input_string)
- # print(hex_result)
- # print(decode_hex(hex_result))
- def distribute_price(amount, num):
- if not num:
- return []
- amount = int(decode_hex(amount))
- return [amount // num] * num, float(f'0.{str(amount / num).split(".")[1]}') * num
- total_amount = complite_to_hex(100000000000)
- total_people = 101
- total, seven = distribute_price(total_amount, total_people)
- print(total, seven)
- print(seven / 24)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement