Решение на Телефонна любов от Дейвид Каменов

Обратно към всички решения

Към профила на Дейвид Каменов

Резултати

  • 9 точки от тестове
  • 0 бонус точки
  • 9 точки общо
  • 35 успешни тест(а)
  • 2 неуспешни тест(а)

Код

'''
Homework 2 Python
Created by David Kamenov
Fifth version. Fixed a bug with the last num in dictionary not_round_degrees_dic
'''
# dictionary for function nums_to_text and text_to_nums
phone_dic = {
' ': 0,
'A': 2,
'B': 22,
'C': 222,
'D': 3,
'E': 33,
'F': 333,
'G': 4,
'H': 44,
'I': 444,
'J': 5,
'K': 55,
'L': 555,
'M': 6,
'N': 66,
'O': 666,
'P': 7,
'Q': 77,
'R': 777,
'S': 7777,
'T': 8,
'U': 88,
'V': 888,
'W': 9,
'X': 99,
'Y': 999,
'Z': 9999,
}
# dictionary for function text_to_angle
rotate_phone_dic = {
1: 30,
2: 60,
3: 90,
4: 120,
5: 150,
6: 180,
7: 210,
8: 240,
9: 270,
0: 300,
None: 330
}
# dictionary for function angle_to_nums
not_round_degrees_dic = {
1: list(range(16, 46)),
2: list(range(46, 76)),
3: list(range(76, 106)),
4: list(range(106, 136)),
5: list(range(136, 166)),
6: list(range(166, 196)),
7: list(range(196, 226)),
8: list(range(226, 256)),
9: list(range(256, 286)),
0: list(range(286, 316))
}
def get_each_letter(index, digits_list, counter):
temp_num = 0
# if the key pressed on the phone is 7 or 9 it has 4 letters otherwise it has 3
if digits_list[index - 1] % 10 in (7, 9):
counter %= 4
if counter == 0:
counter = 4
else:
counter %= 3
if counter == 0:
counter = 3
# make the whole number from numerous digits
for j in range(0, counter):
temp_num = temp_num * 10 + digits_list[index - 1]
# Get the value of the key from the whole number
for key in phone_dic.keys():
if phone_dic[key] == temp_num:
return key
return ''
def nums_to_text(digits_list):
counter = 1
result_string = ''
for i in range(1, len(digits_list)):
if digits_list[i] == digits_list[i - 1] and digits_list[i] != 0:
counter += 1
else:
result_string += get_each_letter(i, digits_list, counter)
counter = 1
else:
result_string += get_each_letter(len(digits_list), digits_list, counter)
return result_string
def text_to_nums(input_string):
nums_list = []
for i in range(0, len(input_string)):
letter_upper = input_string[i].upper()
letter_upper_next = None # value that does not exist anywhere
if i < len(input_string) - 1:
letter_upper_next = input_string[i + 1].upper()
if phone_dic[letter_upper] is not None:
for num in str(phone_dic[letter_upper]):
nums_list.append(int(num))
if i < len(input_string) - 1 and phone_dic[letter_upper] % 10 == phone_dic[letter_upper_next] % 10:
nums_list.append(-1)
return nums_list
def nums_to_angle(digits_list):
result_angle = 0
for digit in digits_list:
if digit != -1:
result_angle += rotate_phone_dic[digit]
if result_angle > 359:
result_angle %= 360
return result_angle
def angles_to_nums(degrees_list):
numbers_list = []
for degree in degrees_list:
degree %= 360
if degree <= 0:
degree += 360
for key in not_round_degrees_dic.keys():
if degree in not_round_degrees_dic[key]:
numbers_list.append(key)
return numbers_list
def is_phone_tastic(text_string):
degrees = nums_to_angle(text_to_nums(text_string))
letters = len(text_string)
return degrees % letters == 0

Лог от изпълнението

..........E...........E..............
======================================================================
ERROR: test_empty_input (test.TestIsPhonetastic)
Test with empty input.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
    raise result
ZeroDivisionError: integer division or modulo by zero

======================================================================
ERROR: test_empty_input (test.TestNumsToText)
Test with empty input.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 67, in thread
    raise result
IndexError: list index out of range

----------------------------------------------------------------------
Ran 37 tests in 0.335s

FAILED (errors=2)

История (5 версии и 4 коментара)

Дейвид обнови решението на 29.10.2022 18:07 (преди над 1 година)

+'''
+ Homework 2 Python
+ Created by David Kamenov
+ First version; I will upload a new version with fixed some code quality issues
+'''
+
+# dictionary for function nums_to_text and text_to_nums
+phone_dic = {
+ ' ': 0,
+ 'A': 2,
+ 'B': 22,
+ 'C': 222,
+ 'D': 3,
+ 'E': 33,
+ 'F': 333,
+ 'G': 4,
+ 'H': 44,
+ 'I': 444,
+ 'J': 5,
+ 'K': 55,
+ 'L': 555,
+ 'M': 6,
+ 'N': 66,
+ 'O': 666,
+ 'P': 7,
+ 'Q': 77,
+ 'R': 777,
+ 'S': 7777,
+ 'T': 8,
+ 'U': 88,
+ 'V': 888,
+ 'W': 9,
+ 'X': 99,
+ 'Y': 999,
+ 'Z': 9999,
+}
+counter = 1
+
+# dictionary for function text_to_angle
+rotate_phone_dic = {
+ 1: 30,
+ 2: 60,
+ 3: 90,
+ 4: 120,
+ 5: 150,
+ 6: 180,
+ 7: 210,
+ 8: 240,
+ 9: 270,
+ 0: 300,
+ None: 330
+}
+
+# dictionary for function angle_to_nums
+not_round_degrees_dic = {
+ 1: list(range(16, 45)),
+ 2: list(range(46, 75)),
+ 3: list(range(76, 105)),
+ 4: list(range(106, 135)),
+ 5: list(range(136, 165)),
+ 6: list(range(166, 195)),
+ 7: list(range(196, 225)),
+ 8: list(range(226, 255)),
+ 9: list(range(256, 285)),
+ 0: list(range(286, 315))
+}
+
+
+def get_each_letter(i, digits_list, temp_num=0, text=''):
+ global counter
+
+ # if the key pressed on the phone is 7 or 9 it has 4 letters otherwise it has 3
+ if digits_list[i - 1] % 10 == 7 or digits_list[i - 1] % 10 == 9:
+ counter %= 4
+ if counter == 0:
+ counter = 4
+ else:
+ counter %= 3
+ if counter == 0:
+ counter = 3
+
+ # make the whole number from numerous digits
+ for j in range(0, counter):
+ temp_num = temp_num * 10 + digits_list[i - 1]
+ counter = 1
+
+ # Get the value of the key from the whole number
+ for key in phone_dic.keys():
+ if phone_dic[key] == temp_num:
+ text += key
+
+ return text
+
+
+def nums_to_text(digits_list):
+ # I could not find any other way except from using global counter because its value has to change in both
+ # functions otherwise the result of the programme is wrong without the right value of the counter maybe there is
+ # a better way to do it but only this came to my mind, and it works fine
+ global counter
+ final_string = ''
+ for i in range(1, len(digits_list)):
+ if digits_list[i] == digits_list[i - 1]:
+ counter += 1
+ else:
+ final_string += get_each_letter(i, digits_list)
+ else:
+ final_string += get_each_letter(len(digits_list), digits_list)
+
+ return final_string
+
+
+def text_to_nums(input_string):
+ nums_list = []
+ for i in range(0, len(input_string)):
+ letter_upper = input_string[i].upper()
+ letter_upper_next = -2 # one that does not exist
+ if i < len(input_string) - 1:
+ letter_upper_next = input_string[i + 1].upper()
+
+ if phone_dic[letter_upper] is not None:
+ for num in str(phone_dic[letter_upper]):
+ nums_list.append(int(num))
+
+ if i < len(input_string) - 1 and phone_dic[letter_upper] % 10 == phone_dic[letter_upper_next] % 10:
+ nums_list.append(-1)
+
+ return nums_list
+
+
+def nums_to_angle(digits_list):
+ result_angle = 0
+ for digit in digits_list:
+ if digit != -1:
+ result_angle += rotate_phone_dic[digit]
+
+ if result_angle > 359:
+ result_angle %= 360
+ return result_angle
+
+
+def angles_to_nums(degrees_list):
+ numbers_list = []
+ for degree in degrees_list:
+ degree %= 360
+ if degree <= 0:
+ degree += 360
+ for key in not_round_degrees_dic.keys():
+ if degree in not_round_degrees_dic[key]:
+ numbers_list.append(key)
+ return numbers_list
+
+
+def is_phone_tastic(text_string):
+ degrees = nums_to_angle(text_to_nums(text_string))
+ letters = len(text_string)
+
+ return degrees % letters == 0

Дейвид обнови решението на 30.10.2022 11:09 (преди над 1 година)

'''
Homework 2 Python
Created by David Kamenov
- First version; I will upload a new version with fixed some code quality issues
+ Second version. Minor code quality fixes
'''
# dictionary for function nums_to_text and text_to_nums
phone_dic = {
' ': 0,
'A': 2,
'B': 22,
'C': 222,
'D': 3,
'E': 33,
'F': 333,
'G': 4,
'H': 44,
'I': 444,
'J': 5,
'K': 55,
'L': 555,
'M': 6,
'N': 66,
'O': 666,
'P': 7,
'Q': 77,
'R': 777,
'S': 7777,
'T': 8,
'U': 88,
'V': 888,
'W': 9,
'X': 99,
'Y': 999,
'Z': 9999,
}
counter = 1
# dictionary for function text_to_angle
rotate_phone_dic = {
1: 30,
2: 60,
3: 90,
4: 120,
5: 150,
6: 180,
7: 210,
8: 240,
9: 270,
0: 300,
None: 330
}
# dictionary for function angle_to_nums
not_round_degrees_dic = {
1: list(range(16, 45)),
2: list(range(46, 75)),
3: list(range(76, 105)),
4: list(range(106, 135)),
5: list(range(136, 165)),
6: list(range(166, 195)),
7: list(range(196, 225)),
8: list(range(226, 255)),
9: list(range(256, 285)),
0: list(range(286, 315))
}
-def get_each_letter(i, digits_list, temp_num=0, text=''):
+def get_each_letter(index, digits_list, temp_num=0, text=''):
global counter
# if the key pressed on the phone is 7 or 9 it has 4 letters otherwise it has 3
- if digits_list[i - 1] % 10 == 7 or digits_list[i - 1] % 10 == 9:
+ if digits_list[index - 1] % 10 == 7 or digits_list[index - 1] % 10 == 9:
counter %= 4
if counter == 0:
counter = 4
else:
counter %= 3
if counter == 0:
counter = 3
# make the whole number from numerous digits
for j in range(0, counter):
- temp_num = temp_num * 10 + digits_list[i - 1]
+ temp_num = temp_num * 10 + digits_list[index - 1]
counter = 1
# Get the value of the key from the whole number
for key in phone_dic.keys():
if phone_dic[key] == temp_num:
text += key
return text
def nums_to_text(digits_list):
# I could not find any other way except from using global counter because its value has to change in both
# functions otherwise the result of the programme is wrong without the right value of the counter maybe there is
# a better way to do it but only this came to my mind, and it works fine

Със сигурност има. Не мога да ти дам идея, защото по-скоро би я възприел като нещо, което получаваш наготово, а не като логичен метод, който да използваш и следващия път. Ако сам измислиш вариант, в който не използваш global, ще е по-лесно да промениш начина си на мислене и да се српавиш с такъв проблем сам при следваща задача.

global counter
- final_string = ''
+ result_string = ''
for i in range(1, len(digits_list)):
if digits_list[i] == digits_list[i - 1]:
counter += 1
else:
- final_string += get_each_letter(i, digits_list)
+ result_string += get_each_letter(i, digits_list)
else:
- final_string += get_each_letter(len(digits_list), digits_list)
+ result_string += get_each_letter(len(digits_list), digits_list)
- return final_string
+ return result_string
def text_to_nums(input_string):
nums_list = []
for i in range(0, len(input_string)):
letter_upper = input_string[i].upper()
- letter_upper_next = -2 # one that does not exist
+ letter_upper_next = -2 # value that does not exist anywhere
if i < len(input_string) - 1:
letter_upper_next = input_string[i + 1].upper()
if phone_dic[letter_upper] is not None:
for num in str(phone_dic[letter_upper]):
nums_list.append(int(num))
if i < len(input_string) - 1 and phone_dic[letter_upper] % 10 == phone_dic[letter_upper_next] % 10:
nums_list.append(-1)
return nums_list
def nums_to_angle(digits_list):
result_angle = 0
for digit in digits_list:
if digit != -1:
result_angle += rotate_phone_dic[digit]
if result_angle > 359:
result_angle %= 360
return result_angle
def angles_to_nums(degrees_list):
numbers_list = []
for degree in degrees_list:
degree %= 360
if degree <= 0:
degree += 360
for key in not_round_degrees_dic.keys():
if degree in not_round_degrees_dic[key]:
numbers_list.append(key)
return numbers_list
def is_phone_tastic(text_string):
degrees = nums_to_angle(text_to_nums(text_string))
letters = len(text_string)
return degrees % letters == 0

Дейвид обнови решението на 31.10.2022 00:18 (преди над 1 година)

'''
Homework 2 Python
Created by David Kamenov
- Second version. Minor code quality fixes
+ Third version. Code quality fixes according to the review
'''
# dictionary for function nums_to_text and text_to_nums
phone_dic = {
' ': 0,
'A': 2,
'B': 22,
'C': 222,
'D': 3,
'E': 33,
'F': 333,
'G': 4,
'H': 44,
'I': 444,
'J': 5,
'K': 55,
'L': 555,
'M': 6,
'N': 66,
'O': 666,
'P': 7,
'Q': 77,
'R': 777,
'S': 7777,
'T': 8,
'U': 88,
'V': 888,
'W': 9,
'X': 99,
'Y': 999,
'Z': 9999,
}
counter = 1
# dictionary for function text_to_angle
rotate_phone_dic = {
1: 30,
2: 60,
3: 90,
4: 120,
5: 150,
6: 180,
7: 210,
8: 240,
9: 270,
0: 300,
None: 330
}
# dictionary for function angle_to_nums
not_round_degrees_dic = {
1: list(range(16, 45)),
2: list(range(46, 75)),
3: list(range(76, 105)),
4: list(range(106, 135)),
5: list(range(136, 165)),
6: list(range(166, 195)),
7: list(range(196, 225)),
8: list(range(226, 255)),
9: list(range(256, 285)),
0: list(range(286, 315))
}
def get_each_letter(index, digits_list, temp_num=0, text=''):
global counter
# if the key pressed on the phone is 7 or 9 it has 4 letters otherwise it has 3
- if digits_list[index - 1] % 10 == 7 or digits_list[index - 1] % 10 == 9:
+ if digits_list[index - 1] % 10 in (7, 9):
counter %= 4
if counter == 0:
counter = 4
else:
counter %= 3
if counter == 0:
counter = 3
# make the whole number from numerous digits
for j in range(0, counter):
temp_num = temp_num * 10 + digits_list[index - 1]
counter = 1
# Get the value of the key from the whole number
for key in phone_dic.keys():
if phone_dic[key] == temp_num:
text += key
return text
def nums_to_text(digits_list):
- # I could not find any other way except from using global counter because its value has to change in both
- # functions otherwise the result of the programme is wrong without the right value of the counter maybe there is
- # a better way to do it but only this came to my mind, and it works fine
global counter
result_string = ''
for i in range(1, len(digits_list)):
if digits_list[i] == digits_list[i - 1]:
counter += 1
else:
result_string += get_each_letter(i, digits_list)
else:
result_string += get_each_letter(len(digits_list), digits_list)
return result_string
def text_to_nums(input_string):
nums_list = []
for i in range(0, len(input_string)):
letter_upper = input_string[i].upper()
- letter_upper_next = -2 # value that does not exist anywhere
+ letter_upper_next = None # value that does not exist anywhere
if i < len(input_string) - 1:
letter_upper_next = input_string[i + 1].upper()
if phone_dic[letter_upper] is not None:
for num in str(phone_dic[letter_upper]):
nums_list.append(int(num))
if i < len(input_string) - 1 and phone_dic[letter_upper] % 10 == phone_dic[letter_upper_next] % 10:
nums_list.append(-1)
return nums_list
def nums_to_angle(digits_list):
result_angle = 0
for digit in digits_list:
if digit != -1:
result_angle += rotate_phone_dic[digit]
if result_angle > 359:
result_angle %= 360
return result_angle
def angles_to_nums(degrees_list):
numbers_list = []
for degree in degrees_list:
degree %= 360
if degree <= 0:
degree += 360
for key in not_round_degrees_dic.keys():
if degree in not_round_degrees_dic[key]:
numbers_list.append(key)
return numbers_list
def is_phone_tastic(text_string):
degrees = nums_to_angle(text_to_nums(text_string))
letters = len(text_string)
return degrees % letters == 0

Дейвид обнови решението на 03.11.2022 12:33 (преди над 1 година)

'''
Homework 2 Python
Created by David Kamenov
- Third version. Code quality fixes according to the review
+ Forth version. Removed gobal variable
'''
# dictionary for function nums_to_text and text_to_nums
phone_dic = {
' ': 0,
'A': 2,
'B': 22,
'C': 222,
'D': 3,
'E': 33,
'F': 333,
'G': 4,
'H': 44,
'I': 444,
'J': 5,
'K': 55,
'L': 555,
'M': 6,
'N': 66,
'O': 666,
'P': 7,
'Q': 77,
'R': 777,
'S': 7777,
'T': 8,
'U': 88,
'V': 888,
'W': 9,
'X': 99,
'Y': 999,
'Z': 9999,
}
-counter = 1
+
# dictionary for function text_to_angle
rotate_phone_dic = {
1: 30,
2: 60,
3: 90,
4: 120,
5: 150,
6: 180,
7: 210,
8: 240,
9: 270,
0: 300,
None: 330
}
# dictionary for function angle_to_nums
not_round_degrees_dic = {
1: list(range(16, 45)),
2: list(range(46, 75)),
3: list(range(76, 105)),
4: list(range(106, 135)),
5: list(range(136, 165)),
6: list(range(166, 195)),
7: list(range(196, 225)),
8: list(range(226, 255)),
9: list(range(256, 285)),
0: list(range(286, 315))
}
-def get_each_letter(index, digits_list, temp_num=0, text=''):
- global counter
-
+def get_each_letter(index, digits_list, counter):
+ temp_num = 0
# if the key pressed on the phone is 7 or 9 it has 4 letters otherwise it has 3
if digits_list[index - 1] % 10 in (7, 9):
counter %= 4
if counter == 0:
counter = 4
else:
counter %= 3
if counter == 0:
counter = 3
# make the whole number from numerous digits
for j in range(0, counter):
temp_num = temp_num * 10 + digits_list[index - 1]
- counter = 1
# Get the value of the key from the whole number
for key in phone_dic.keys():
if phone_dic[key] == temp_num:
- text += key
+ return key
- return text
+ return ''
def nums_to_text(digits_list):
- global counter
+ counter = 1
result_string = ''
for i in range(1, len(digits_list)):
- if digits_list[i] == digits_list[i - 1]:
+ if digits_list[i] == digits_list[i - 1] and digits_list[i] != 0:
counter += 1
else:
- result_string += get_each_letter(i, digits_list)
+ result_string += get_each_letter(i, digits_list, counter)
+ counter = 1
else:
- result_string += get_each_letter(len(digits_list), digits_list)
+ result_string += get_each_letter(len(digits_list), digits_list, counter)
return result_string
def text_to_nums(input_string):
nums_list = []
for i in range(0, len(input_string)):
letter_upper = input_string[i].upper()
letter_upper_next = None # value that does not exist anywhere
if i < len(input_string) - 1:
letter_upper_next = input_string[i + 1].upper()
if phone_dic[letter_upper] is not None:
for num in str(phone_dic[letter_upper]):
nums_list.append(int(num))
if i < len(input_string) - 1 and phone_dic[letter_upper] % 10 == phone_dic[letter_upper_next] % 10:
nums_list.append(-1)
return nums_list
def nums_to_angle(digits_list):
result_angle = 0
for digit in digits_list:
if digit != -1:
result_angle += rotate_phone_dic[digit]
if result_angle > 359:
result_angle %= 360
return result_angle
def angles_to_nums(degrees_list):
numbers_list = []
for degree in degrees_list:
degree %= 360
if degree <= 0:
degree += 360
for key in not_round_degrees_dic.keys():
if degree in not_round_degrees_dic[key]:
numbers_list.append(key)
return numbers_list
def is_phone_tastic(text_string):
degrees = nums_to_angle(text_to_nums(text_string))
letters = len(text_string)
return degrees % letters == 0

Дейвид обнови решението на 03.11.2022 14:17 (преди над 1 година)

'''
Homework 2 Python
Created by David Kamenov
- Forth version. Removed gobal variable
+ Fifth version. Fixed a bug with the last num in dictionary not_round_degrees_dic
'''
-
# dictionary for function nums_to_text and text_to_nums
phone_dic = {
' ': 0,
'A': 2,
'B': 22,
'C': 222,
'D': 3,
'E': 33,
'F': 333,
'G': 4,
'H': 44,
'I': 444,
'J': 5,
'K': 55,
'L': 555,
'M': 6,
'N': 66,
'O': 666,
'P': 7,
'Q': 77,
'R': 777,
'S': 7777,
'T': 8,
'U': 88,
'V': 888,
'W': 9,
'X': 99,
'Y': 999,
'Z': 9999,
}
-
# dictionary for function text_to_angle
rotate_phone_dic = {
1: 30,
2: 60,
3: 90,
4: 120,
5: 150,
6: 180,
7: 210,
8: 240,
9: 270,
0: 300,
None: 330
}
# dictionary for function angle_to_nums
not_round_degrees_dic = {
- 1: list(range(16, 45)),
- 2: list(range(46, 75)),
- 3: list(range(76, 105)),
- 4: list(range(106, 135)),
- 5: list(range(136, 165)),
- 6: list(range(166, 195)),
- 7: list(range(196, 225)),
- 8: list(range(226, 255)),
- 9: list(range(256, 285)),
- 0: list(range(286, 315))
+ 1: list(range(16, 46)),
+ 2: list(range(46, 76)),
+ 3: list(range(76, 106)),
+ 4: list(range(106, 136)),
+ 5: list(range(136, 166)),
+ 6: list(range(166, 196)),
+ 7: list(range(196, 226)),
+ 8: list(range(226, 256)),
+ 9: list(range(256, 286)),
+ 0: list(range(286, 316))
}
def get_each_letter(index, digits_list, counter):
temp_num = 0
# if the key pressed on the phone is 7 or 9 it has 4 letters otherwise it has 3
if digits_list[index - 1] % 10 in (7, 9):
counter %= 4
if counter == 0:
counter = 4
else:
counter %= 3
if counter == 0:
counter = 3
# make the whole number from numerous digits
for j in range(0, counter):
temp_num = temp_num * 10 + digits_list[index - 1]
# Get the value of the key from the whole number
for key in phone_dic.keys():
if phone_dic[key] == temp_num:
return key
return ''
def nums_to_text(digits_list):
counter = 1
result_string = ''
for i in range(1, len(digits_list)):
if digits_list[i] == digits_list[i - 1] and digits_list[i] != 0:
counter += 1
else:
result_string += get_each_letter(i, digits_list, counter)
counter = 1
else:
result_string += get_each_letter(len(digits_list), digits_list, counter)
return result_string
def text_to_nums(input_string):
nums_list = []
for i in range(0, len(input_string)):
letter_upper = input_string[i].upper()
letter_upper_next = None # value that does not exist anywhere
if i < len(input_string) - 1:
letter_upper_next = input_string[i + 1].upper()
if phone_dic[letter_upper] is not None:
for num in str(phone_dic[letter_upper]):
nums_list.append(int(num))
if i < len(input_string) - 1 and phone_dic[letter_upper] % 10 == phone_dic[letter_upper_next] % 10:
nums_list.append(-1)
return nums_list
def nums_to_angle(digits_list):
result_angle = 0
for digit in digits_list:
if digit != -1:
result_angle += rotate_phone_dic[digit]
if result_angle > 359:
result_angle %= 360
return result_angle
def angles_to_nums(degrees_list):
numbers_list = []
for degree in degrees_list:
degree %= 360
if degree <= 0:
degree += 360
for key in not_round_degrees_dic.keys():
if degree in not_round_degrees_dic[key]:
numbers_list.append(key)
return numbers_list
def is_phone_tastic(text_string):
degrees = nums_to_angle(text_to_nums(text_string))
letters = len(text_string)
return degrees % letters == 0