This repository has been archived on 2025-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
Files
python_it_top/21-10/scrabble_onetask.py
2025-10-21 20:01:30 +05:00

53 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Основная функция.
# для возврата значений ошибок текста и самого вывода баллов
# буду использовать get_coords для создания возврата значений в кортеж
def scrabble(text):
#=====
# Обьявление переменных
#=====
# Словарь, слово: балл
alphabet = {
# English alphabet
'a': 1, 'e': 1, 'i': 1, 'o': 1, 'l': 1, 'n': 1, 's': 1, 't': 1, 'r': 1,
'd': 2, 'g': 2,
'b': 3, 'c': 3, 'm': 3, 'p': 3,
'f': 4, 'h': 4, 'w': 4, 'y': 4,
'k': 5,
'j': 8, 'x': 8,
'q': 10, 'z': 10,
# Russian alphabet
'а': 1, 'в': 1, 'е': 1, 'и': 1, 'н': 1, 'о': 1, 'с': 1, 'т': 1,
'д': 2, 'к': 2, 'л': 2, 'м': 2, 'п': 2, 'у': 2, 'р': 2, # "р" не было, на рандом добавил в 2 баллы.
'б': 3, 'г': 3, 'ё': 3, 'ь': 3, 'я': 3,
'й': 4, 'ы': 4,
'ж': 5, 'з': 5, 'ч': 5, 'ц': 5,
'ш': 8, 'э': 8, 'ю': 9,
'ф': 10, 'щ': 10, 'ъ': 10}
text = text.replace(' ', '') # убираю пробелы
text = text.lower() # делаю все символы низкими
score = 0 # нулевой счетчик баллов
symb_err = [] # инициализация списка для символов не в алфавите
# =====
# Главная логика
# =====
for symbol in text:
if symbol in alphabet:
score += alphabet[symbol]
else:
symb_err.append(symbol)
return score, symb_err
def parral_game(players):
for rond in range(1,10+1):
print(f"{rond} round")
if