Редни числа

Краен срок
28.10.2022 18:00

Срокът за предаване на решения е отминал

Редни и бройни числа

Бройните числа изразяват брой (очевидно) или с други думи "размер на група обекти" - три ябълки, дванайсет месеца, 52 лева и 33 стотинки, голямата примоция.
Редните числа изразяват позицията на даден обект в подредена редица - първо място, трети шот, 5-и избори за последната година и половина.

В английския език правилата за образуване на редните числа са една идея по-прости от българския - добавяме наставките "st", "nd", "rd" и "th", в зависимост от типа на числото. Дотук ясно...
(ние имаме неща от типа на хиляден, нулев и прочие, които усложняват ситуацията, мъжки и женски род и опции за изписване на 5-и или 5-ти, които само ще създадат дебати)

Предизвикателството

Напишете функция suffix_ordinals, която да приема числа, разделени с точка, под формата на низ - "61123.205.11.0", и да връща низ със суфиксираните (наставените?) числа в редната им форма - "61123rd of the 205th of the 11th of the 0th", отново като низ.

>>> suffix_ordinals("61123.205.11.0")
"61123rd of the 205th of the 11th of the 0th"

>>> suffix_ordinals("2")
"2nd"

Решения

Харут Партамиан
  • Некоректно
  • 7 успешни тест(а)
  • 1 неуспешни тест(а)
Харут Партамиан
def suffix_ordinals(numbers_string):
list_of_numbers = numbers_string.split('.')
output_string = ""
for string_number in list_of_numbers:
integer_number = int(string_number)
last_digit = integer_number % 10
if integer_number in range(11, 20):
output_string += f"{integer_number}th of the "
elif last_digit == 1:
output_string += f"{integer_number}st of the "
elif last_digit == 2:
output_string += f"{integer_number}nd of the "
elif last_digit == 3:
output_string += f"{integer_number}rd of the "
elif last_digit in (0, 4, 5, 6, 7, 8, 9):
output_string += f"{integer_number}th of the "
return output_string[:len(output_string) - 8]
.Fs.....
======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd
?    -            ^^                    ^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


----------------------------------------------------------------------
Ran 8 tests in 0.078s

FAILED (failures=1, skipped=1)
Ивана Дончевска
  • Некоректно
  • 7 успешни тест(а)
  • 1 неуспешни тест(а)
Ивана Дончевска
import re
def suffix_ordinals(given_string):
list_of_numbers = map(int, re.findall(r'\d+', given_string)) # Using regex to get only numbers(integers)
new_string = ""
for number in list_of_numbers:
if number % 10 == 1 and number != 11:
new_string += str(number) + "st of the "
elif number % 10 == 2 and number != 12:
new_string += str(number) + "nd of the "
elif number % 10 == 3 and number != 13:
new_string += str(number) + "rd of the "
else:
new_string += str(number) + "th of the "
return new_string[:-8] # Without last 8 characters
.Fs.....
======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd
?    -            ^^                    ^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


----------------------------------------------------------------------
Ran 8 tests in 0.085s

FAILED (failures=1, skipped=1)
Дейвид Каменов
  • Некоректно
  • 1 успешни тест(а)
  • 7 неуспешни тест(а)
Дейвид Каменов
'''
Created by David Kamenov
Challenge 1 Suffixes
Problems that occurred here
1) digits in number; there was a problem using foreach here in the second for when
there was a number with the same digits; that's why I used standard for here. For sure there is a way to do it
using foreach but this is the first thing that came to my mind
2) numbers being/containing 11, 12, 13; solved this way: if number[-2:] == '11'
'''
def suffix_ordinals(input_numbers):
new_numbers = input_numbers.split('.')
new_str = ''
for number in new_numbers:
for i in range(0, len(number)):
if i != len(number) - 1:
new_str += number[i]
else:
if number[i] == '1':
if number[-2:] == '11':
new_str += number[i] + 'th '
else:
new_str += number[i] + 'st '
elif number[i] == '2':
if number[-2:] == '12':
new_str += number[i] + 'th '
else:
new_str += number[i] + 'nd '
elif number[i] == '3':
if number[-2:] == '13':
new_str += number[i] + 'th '
else:
new_str += number[i] + 'rd '
else:
new_str += number[i] + 'th '
if number != new_numbers[-1]:
new_str += 'of the '
return str(new_str)
FFsFFFFF
======================================================================
FAIL: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
AssertionError: '11th[35 chars]h of the 15th of the 16th of the 17th of the 18th of the 19th ' != '11th[35 chars]h of the 15th of the 16th of the 17th of the 18th of the 19th'
- 11th of the 12th of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th 
?                                                                                                     -
+ 11th of the 12th of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th


======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111th of the 312th of the 998342421713th ' != '111th of the 312th of the 998342421713th'
- 111th of the 312th of the 998342421713th 
?                                         -
+ 111th of the 312th of the 998342421713th


======================================================================
FAIL: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
AssertionError: '2nd 2nd 2nd 2nd ' != '2nd of the 2nd of the 2nd of the 2nd'
- 2nd 2nd 2nd 2nd 
+ 2nd of the 2nd of the 2nd of the 2nd


======================================================================
FAIL: test_other_than_teens (test.TestSuffixOrdinals)
Test elements other than teens (11-19).
----------------------------------------------------------------------
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
AssertionError: '21st[21 chars]3rd of the 56th of the 165th of the 12342nd of the 12344556th ' != '21st[21 chars]3rd of the 56th of the 165th of the 12342nd of the 12344556th'
- 21st of the 32nd of the 43rd of the 56th of the 165th of the 12342nd of the 12344556th 
?                                                                                       -
+ 21st of the 32nd of the 43rd of the 56th of the 165th of the 12342nd of the 12344556th


======================================================================
FAIL: test_regular_digits (test.TestSuffixOrdinals)
Test all regular digits.
----------------------------------------------------------------------
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
AssertionError: '0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th ' != '0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th'
- 0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th 
?                                                                      -
+ 0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th


======================================================================
FAIL: test_single_number (test.TestSuffixOrdinals)
Test with single number.
----------------------------------------------------------------------
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
AssertionError: '5th ' != '5th'
- 5th 
?    -
+ 5th


======================================================================
FAIL: test_special_digits (test.TestSuffixOrdinals)
Test all special digits.
----------------------------------------------------------------------
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
AssertionError: '1st of the 2nd of the 3rd ' != '1st of the 2nd of the 3rd'
- 1st of the 2nd of the 3rd 
?                          -
+ 1st of the 2nd of the 3rd


----------------------------------------------------------------------
Ran 8 tests in 0.092s

FAILED (failures=7, skipped=1)
Александър Стоилов
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Александър Стоилов
def get_suffix(number_str):
if number_str[-2::] in ["11", "12", "13"]:
return "th"
if number_str[-1] == "1":
return "st"
elif number_str[-1] == "2":
return "nd"
elif number_str[-1] == "3":
return "rd"
else:
return "th"
def suffix_ordinals(input_str):
if input_str in [".", ""]:
return ""
numbers_list = list(input_str.split("."))
return ' of the '.join([number + get_suffix(number) for number in numbers_list])
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.074s

OK (skipped=1)
Александър Сариков
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Александър Сариков
def suffix_ordinals(nums):
def add_suffix(n):
if len(n) > 1 and n[-2] == '1':
return n + 'th'
elif n[-1] == '1':
return n + 'st'
elif n[-1] == '2':
return n + 'nd'
elif n[-1] == '3':
return n + 'rd'
else:
return n + 'th'
return " of the ".join(add_suffix(num) for num in nums.split('.') if num)
## one-line attempt :)
# def suffix_ordinals(nums):
# return " of the ".join((len(n) > 1 and n[-2] == '1' and n + 'th') or (n[-1] == '1' and n + 'st') or (n[-1] == '2' and n + 'nd') or (n[-1] == '3' and n + 'rd') or n + 'th' for n in nums.split('.') if n)
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.075s

OK (skipped=1)
Емилиан Спасов
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Емилиан Спасов
def is_number_special_case(number: str) -> bool:
return len(number) > 1 and int(number[-2]) == 1
def map_number_to_number_with_suffix(number: str) -> str:
if is_number_special_case(number):
return f'{number}th'
last_digit = int(number[-1])
if last_digit == 1:
return f'{number}st'
elif last_digit == 2:
return f'{number}nd'
elif last_digit == 3:
return f'{number}rd'
return f'{number}th'
def suffix_ordinals(raw_numbers: str) -> str:
numbers = raw_numbers.split(".")
mapped_numbers = list(map(map_number_to_number_with_suffix, numbers))
return " of the ".join(mapped_numbers)
if __name__ == '__main__':
print(
suffix_ordinals("61123.205.11.0") ==
"61123rd of the 205th of the 11th of the 0th")
print(suffix_ordinals("2") == "2nd")
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.079s

OK (skipped=1)
Сузана Петкова
  • Некоректно
  • 1 успешни тест(а)
  • 7 неуспешни тест(а)
Сузана Петкова
def suffix_ordinals(numbers):
integer_numbers = [int(num) for num in numbers.split('.')]
result = []
for num in integer_numbers:
remainder = num % 10
string_num = str(num)
if remainder not in (1, 2, 3):
result.append(string_num + 'th of the')
elif remainder == 1:
result.append(string_num + 'st of the')
elif remainder == 2:
result.append(string_num + 'nd of the')
else:
result.append(string_num + 'rd of the')
result_string = ' '.join(result)
return result_string[:result_string.rindex('of the')]
FFsFFFFF
======================================================================
FAIL: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
AssertionError: '11st of the 12nd of the 13rd of the 14th of[54 chars]9th ' != '11th of the 12th of the 13th of the 14th of[53 chars]19th'
- 11st of the 12nd of the 13rd of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th 
?   -           ^^          ^^                                                                        -
+ 11th of the 12th of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?    +          ^^          ^^


======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd ' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd 
?    -            ^^                    ^^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


======================================================================
FAIL: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
AssertionError: '2nd of the 2nd of the 2nd of the 2nd ' != '2nd of the 2nd of the 2nd of the 2nd'
- 2nd of the 2nd of the 2nd of the 2nd 
?                                     -
+ 2nd of the 2nd of the 2nd of the 2nd


======================================================================
FAIL: test_other_than_teens (test.TestSuffixOrdinals)
Test elements other than teens (11-19).
----------------------------------------------------------------------
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
AssertionError: '21st[21 chars]3rd of the 56th of the 165th of the 12342nd of the 12344556th ' != '21st[21 chars]3rd of the 56th of the 165th of the 12342nd of the 12344556th'
- 21st of the 32nd of the 43rd of the 56th of the 165th of the 12342nd of the 12344556th 
?                                                                                       -
+ 21st of the 32nd of the 43rd of the 56th of the 165th of the 12342nd of the 12344556th


======================================================================
FAIL: test_regular_digits (test.TestSuffixOrdinals)
Test all regular digits.
----------------------------------------------------------------------
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
AssertionError: '0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th ' != '0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th'
- 0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th 
?                                                                      -
+ 0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th


======================================================================
FAIL: test_single_number (test.TestSuffixOrdinals)
Test with single number.
----------------------------------------------------------------------
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
AssertionError: '5th ' != '5th'
- 5th 
?    -
+ 5th


======================================================================
FAIL: test_special_digits (test.TestSuffixOrdinals)
Test all special digits.
----------------------------------------------------------------------
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
AssertionError: '1st of the 2nd of the 3rd ' != '1st of the 2nd of the 3rd'
- 1st of the 2nd of the 3rd 
?                          -
+ 1st of the 2nd of the 3rd


----------------------------------------------------------------------
Ran 8 tests in 0.091s

FAILED (failures=7, skipped=1)
Стилиян Иванов
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Стилиян Иванов
def suffix_ordinals(cardinal_numbers):
return " of the ".join([
number + "st" if int(number) % 10 == 1 and int(number) % 100 != 11 else
number + "nd" if int(number) % 10 == 2 and int(number) % 100 != 12 else
number + "rd" if int(number) % 10 == 3 and int(number) % 100 != 13 else
number + "th"
for number in cardinal_numbers.split(".") if number != ""
])
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.075s

OK (skipped=1)
Таня Сейкова
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Таня Сейкова
def get_suffix(num) :
last_digit = num[-1]
is_eleven_to_thirteen = False
if len(num) > 1:
if num[-2] == '1' and (last_digit == '1' or last_digit == '2' or last_digit == '3'):
is_eleven_to_thirteen = True
if last_digit == '1' and not is_eleven_to_thirteen:
return "st"
if last_digit == '2' and not is_eleven_to_thirteen:
return "nd"
if last_digit == '3' and not is_eleven_to_thirteen:
return "rd"
return "th"
def suffix_ordinals(input) :
numbers_ = input.split(".")
res = ""
len_numbers = len(numbers_)
text_suffix = " of the "
for index, num in enumerate(numbers_):
res += num + get_suffix(num)
if (index < len_numbers - 1):
res += text_suffix
return res
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.082s

OK (skipped=1)
Йордан Глигоров
  • Некоректно
  • 7 успешни тест(а)
  • 1 неуспешни тест(а)
Йордан Глигоров
def get_last_number(str):
length = len(str)
last_number = length
for i in range(length - 1, -1, -1):
if str[i] != '.':
last_number = i
break
return last_number
def get_sufix(str, index, number_sufixes):
if index - 1 > 0 and str[index - 1] == "1":
return ("th of the ")
else:
return "{} of the ".format(number_sufixes[str[index]])
def get_last_number_sufix(str, index, number_sufixes):
if index - 1 >= 0 and str[index - 1] == "1":
return ("{}th".format(str[index]))
else:
return "{}{}".format(str[index], number_sufixes[str[index]])
def suffix_ordinals(str):
number_sufixes = {"1":"st", "2":"nd", "3":"rd", "4":"th", "5":"th", "6":"th", "7":"th", "8":"th", "9":"th", "0":"th"}
result = []
length = len(str)
last_number = get_last_number(str)
for i in range(0, length):
if str[i] == '.':
if i == 0:
continue
if str[i - 1] == '.':
continue
result.append(get_sufix(str, i - 1, number_sufixes))
elif i == last_number:
result.append(get_last_number_sufix(str, i, number_sufixes))
break
else:
result.append(str[i])
return "".join(result)
#it is a better solution to use split(".") but I already wrote this
F.s.....
======================================================================
FAIL: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
AssertionError: '11st of the 12th of the 13th of the 14th of[53 chars]19th' != '11th of the 12th of the 13th of the 14th of[53 chars]19th'
- 11st of the 12th of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?   -
+ 11th of the 12th of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?    +


----------------------------------------------------------------------
Ran 8 tests in 0.085s

FAILED (failures=1, skipped=1)
Алекс Божинов
  • Некоректно
  • 7 успешни тест(а)
  • 1 неуспешни тест(а)
Алекс Божинов
def suffix_ordinals(countables: str):
if len(countables) == 0:
return ""
numbers = countables.split('.')
suffixed_numbers = ''
for number in numbers:
if (number[len(number) - 2:len(number):1] == '11' or
number[len(number) - 2:len(number):1] == '12' or
number[len(number) - 2:len(number):1] == '13'):
suffixed_numbers += (number + 'th')
elif number[-1] == '1':
suffixed_numbers += (number + 'st')
elif number[-1] == '2':
suffixed_numbers += (number + 'nd')
elif number[-1] == '3':
suffixed_numbers += (number + 'rd')
else:
suffixed_numbers += (number + 'th')
if number is not numbers[-1]:
suffixed_numbers += ' of the '
return suffixed_numbers
..sF....
======================================================================
FAIL: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
AssertionError: '2nd2nd2nd2nd' != '2nd of the 2nd of the 2nd of the 2nd'
- 2nd2nd2nd2nd
+ 2nd of the 2nd of the 2nd of the 2nd


----------------------------------------------------------------------
Ran 8 tests in 0.078s

FAILED (failures=1, skipped=1)
Цветелина Чакърова
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Цветелина Чакърова
def suffix_ordinals(dotted_number):
final_number = ""
for number in dotted_number.split('.'):
if final_number == "":
final_number += number
else:
final_number += " of the " + number
int_number = int(number)
if int_number % 10 == 1 and int_number % 100 != 11:
final_number += "st"
elif int_number % 10 == 2 and int_number % 100 != 12:
final_number += "nd"
elif int_number % 10 == 3 and int_number % 100 != 13:
final_number += "rd"
else:
final_number += "th"
return final_number
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.081s

OK (skipped=1)
Весела Петрова
  • Некоректно
  • 1 успешни тест(а)
  • 7 неуспешни тест(а)
Весела Петрова
def suffix_ordinals(string):
counter = 0
final_result = ''
for num in string.split('.'):
if counter > 0:
final_result += ' of the '
if int(num) % 10 == 1:
if (int(num) // 10) % 10 == 1:
final_result += num + 'th'
else:
final_result += num + 'st'
counter += 1
continue
if int(num) % 10 == 2:
if (int(num) // 10) % 10 == 1:
final_result += num + 'th'
else:
final_result += num + 'nd'
counter += 1
continue
if int(num) % 10 == 3:
if (int(num) // 10) % 10 == 1:
final_result += num + 'th'
else:
final_result += num + 'rd'
counter += 1
continue
final_result += num + 'th'
counter += 1
print(final_result)
FFsFFFFF
======================================================================
FAIL: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
AssertionError: None != '11th of the 12th of the 13th of the 14th[56 chars]19th'

======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: None != '111th of the 312th of the 998342421713th'

======================================================================
FAIL: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
AssertionError: None != '2nd of the 2nd of the 2nd of the 2nd'

======================================================================
FAIL: test_other_than_teens (test.TestSuffixOrdinals)
Test elements other than teens (11-19).
----------------------------------------------------------------------
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
AssertionError: None != '21st of the 32nd of the 43rd of the 56th[42 chars]56th'

======================================================================
FAIL: test_regular_digits (test.TestSuffixOrdinals)
Test all regular digits.
----------------------------------------------------------------------
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
AssertionError: None != '0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th'

======================================================================
FAIL: test_single_number (test.TestSuffixOrdinals)
Test with single number.
----------------------------------------------------------------------
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
AssertionError: None != '5th'

======================================================================
FAIL: test_special_digits (test.TestSuffixOrdinals)
Test all special digits.
----------------------------------------------------------------------
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
AssertionError: None != '1st of the 2nd of the 3rd'

----------------------------------------------------------------------
Ran 8 tests in 0.083s

FAILED (failures=7, skipped=1)
Александра Павлова
  • Некоректно
  • 5 успешни тест(а)
  • 3 неуспешни тест(а)
Александра Павлова
def suffix_ordinals(numbers_string):
numbers = numbers_string.split('.')
output = ''
for number in numbers:
last_digit = number[-1]
if last_digit == '1':
output += f'{number}st'
elif last_digit == '2':
output += f'{number}nd'
elif last_digit == '3':
output += f'{number}rd'
else:
output += f'{number}th'
if number != numbers[-1]:
output += ' of the '
return output
FFsF....
======================================================================
FAIL: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
AssertionError: '11st of the 12nd of the 13rd of the 14th of[53 chars]19th' != '11th of the 12th of the 13th of the 14th of[53 chars]19th'
- 11st of the 12nd of the 13rd of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?   -           ^^          ^^
+ 11th of the 12th of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?    +          ^^          ^^


======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd
?    -            ^^                    ^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


======================================================================
FAIL: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
AssertionError: '2nd2nd2nd2nd' != '2nd of the 2nd of the 2nd of the 2nd'
- 2nd2nd2nd2nd
+ 2nd of the 2nd of the 2nd of the 2nd


----------------------------------------------------------------------
Ran 8 tests in 0.081s

FAILED (failures=3, skipped=1)
Лиляна Белчева
  • Некоректно
  • 7 успешни тест(а)
  • 1 неуспешни тест(а)
Лиляна Белчева
def get_suffix(number):
if number in [11, 12, 13]:
return "th"
last_integer = number % 10
if last_integer == 1:
return "st"
elif last_integer == 2:
return "nd"
elif last_integer == 3:
return "rd"
else:
return "th"
def suffix_ordinals(numbers):
partial_number, full_sentence = '', ''
connection_str = ' of the '
counter = numbers.count('.')
for letter in numbers:
if letter == '.':
ordinal_number = partial_number + get_suffix(int(partial_number))
full_sentence += (ordinal_number + connection_str)
partial_number = ''
counter -= 1
else:
partial_number += letter
full_sentence += (partial_number + get_suffix(int(partial_number)))
return full_sentence
.Fs.....
======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd
?    -            ^^                    ^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


----------------------------------------------------------------------
Ran 8 tests in 0.079s

FAILED (failures=1, skipped=1)
Виктор
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Виктор
SUFFIX_MAPPING = {'11': 'th', '12': 'th', '13': 'th', '1': 'st', '2': 'nd', '3': 'rd'}
def suffix_ordinals(ordinals):
split_ordinals = ordinals.split('.')
for index, ordinal in enumerate(split_ordinals):
split_ordinals[index] += (SUFFIX_MAPPING.get(ordinal[-2:]) or
SUFFIX_MAPPING.get(ordinal[-1], 'th'))
return ' of the '.join(split_ordinals)
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.083s

OK (skipped=1)
Назифе Алиджик
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Назифе Алиджик
def suffix_ordinals(numbers_as_string):
numbers = numbers_as_string.split('.')
for i in range(0, len(numbers)):
numbers[i] = int(numbers[i])
ordinals = []
for number in numbers:
ordinals.append(str(number) + {1: 'st', 2: 'nd', 3: 'rd'}.get(4 if 10 <= number % 100 < 20 else number % 10, "th"))
ordinals.append(" of ")
ordinals.append("the ")
del ordinals[-2:]
return "".join(ordinals)
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.089s

OK (skipped=1)
Николета Бейска
  • Некоректно
  • 1 успешни тест(а)
  • 7 неуспешни тест(а)
Николета Бейска
def suffix_ordinals(string_of_numbers):
numbers = string_of_numbers.split('.')
count_numbers = len(numbers)
for number in numbers:
answer.append(number)
count_numbers -= 1
if len(number) != 1 and number[-2] == "1":
answer.append("th")
else:
match number[-1]:
case "1":
answer.append("st")
case "2":
answer.append("nd")
case "3":
answer.append("rd")
case _:
answer.append("th")
if count_numbers != 0:
answer.append(" of the ")
ordinals = ''.join(answer)
return ordinals
EEsEEEEE
======================================================================
ERROR: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
NameError: name 'answer' is not defined

======================================================================
ERROR: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
NameError: name 'answer' is not defined

======================================================================
ERROR: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
NameError: name 'answer' is not defined

======================================================================
ERROR: test_other_than_teens (test.TestSuffixOrdinals)
Test elements other than teens (11-19).
----------------------------------------------------------------------
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
NameError: name 'answer' is not defined

======================================================================
ERROR: test_regular_digits (test.TestSuffixOrdinals)
Test all regular digits.
----------------------------------------------------------------------
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
NameError: name 'answer' is not defined

======================================================================
ERROR: test_single_number (test.TestSuffixOrdinals)
Test with single number.
----------------------------------------------------------------------
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
NameError: name 'answer' is not defined

======================================================================
ERROR: test_special_digits (test.TestSuffixOrdinals)
Test all special digits.
----------------------------------------------------------------------
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
NameError: name 'answer' is not defined

----------------------------------------------------------------------
Ran 8 tests in 0.080s

FAILED (errors=7, skipped=1)
Велислава Крумова
  • Некоректно
  • 1 успешни тест(а)
  • 7 неуспешни тест(а)
Велислава Крумова
def suffix_ordinals(num_string):
num_list = num_string.split(".")
result_string = ''
for num in num_list:
if int(num) % 10 == 1:
result_string += num + 'st of the '
elif int(num) % 10 == 2:
result_string += num + 'nd of the '
elif int(num) % 10 == 3:
result_string += num + 'rd of the '
else:
result_string += num + 'th of the '
return result_string.removesuffix(result_string[-7:])
FFsFFFFF
======================================================================
FAIL: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
AssertionError: '11st of the 12nd of the 13rd of the 14th of[54 chars]9th ' != '11th of the 12th of the 13th of the 14th of[53 chars]19th'
- 11st of the 12nd of the 13rd of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th 
?   -           ^^          ^^                                                                        -
+ 11th of the 12th of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?    +          ^^          ^^


======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd ' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd 
?    -            ^^                    ^^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


======================================================================
FAIL: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
AssertionError: '2nd of the 2nd of the 2nd of the 2nd ' != '2nd of the 2nd of the 2nd of the 2nd'
- 2nd of the 2nd of the 2nd of the 2nd 
?                                     -
+ 2nd of the 2nd of the 2nd of the 2nd


======================================================================
FAIL: test_other_than_teens (test.TestSuffixOrdinals)
Test elements other than teens (11-19).
----------------------------------------------------------------------
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
AssertionError: '21st[21 chars]3rd of the 56th of the 165th of the 12342nd of the 12344556th ' != '21st[21 chars]3rd of the 56th of the 165th of the 12342nd of the 12344556th'
- 21st of the 32nd of the 43rd of the 56th of the 165th of the 12342nd of the 12344556th 
?                                                                                       -
+ 21st of the 32nd of the 43rd of the 56th of the 165th of the 12342nd of the 12344556th


======================================================================
FAIL: test_regular_digits (test.TestSuffixOrdinals)
Test all regular digits.
----------------------------------------------------------------------
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
AssertionError: '0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th ' != '0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th'
- 0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th 
?                                                                      -
+ 0th of the 4th of the 5th of the 6th of the 7th of the 8th of the 9th


======================================================================
FAIL: test_single_number (test.TestSuffixOrdinals)
Test with single number.
----------------------------------------------------------------------
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
AssertionError: '5th ' != '5th'
- 5th 
?    -
+ 5th


======================================================================
FAIL: test_special_digits (test.TestSuffixOrdinals)
Test all special digits.
----------------------------------------------------------------------
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
AssertionError: '1st of the 2nd of the 3rd ' != '1st of the 2nd of the 3rd'
- 1st of the 2nd of the 3rd 
?                          -
+ 1st of the 2nd of the 3rd


----------------------------------------------------------------------
Ran 8 tests in 0.091s

FAILED (failures=7, skipped=1)
Роберт Борисов
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Роберт Борисов
def suffix_ordinals(numbers_dots):
st = "st"
th = "th"
rd = "rd"
nd = "nd"
numbers = numbers_dots.split('.')
suffix_numbers = []
for number in numbers:
prefix = ""
if len(number) > 1 and number[len(number) - 2] == "1":
prefix = "".join(th)
elif number[len(number) - 1] == "1":
prefix = "".join(st)
elif number[len(number) - 1] == "2":
prefix = "".join(nd)
elif number[len(number) - 1] == "3":
prefix = "".join(rd)
else:
prefix = "".join(th)
suffix_numbers.append(number + prefix)
return " of the ".join(suffix_numbers)
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.075s

OK (skipped=1)
Антоан Ивайлов
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Антоан Ивайлов
def generate_suffix(raw_word):
# Check to see for corner cases of 11 and 12. All numbers in range [10,20] have a "th" suffix
if len(raw_word) > 1:
pre_end_digit = raw_word[-2]
if pre_end_digit == '1':
return "th" # We omit the else case, the returns below will be valid
end_digit = raw_word[-1]
if end_digit == '1':
return "st"
elif end_digit == '2':
return "nd"
elif end_digit == '3':
return "rd"
else:
return "th"
def convert_word(raw_word):
return raw_word + generate_suffix(raw_word)
def suffix_ordinals(raw_numbers_input):
number_collection = raw_numbers_input.split('.')
index = 0
while index < len(number_collection):
number_collection[index] = convert_word(number_collection[index])
index += 1
final_str = str()
index = 0
while index < len(number_collection) - 1:
final_str += number_collection[index] + " of the "
index += 1
final_str += number_collection[index] # We make n-1 iterations as to concatenate with "of the" part correctly.
return final_str
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.073s

OK (skipped=1)
Виктор Боев
  • Некоректно
  • 5 успешни тест(а)
  • 3 неуспешни тест(а)
Виктор Боев
def suffix_ordinals(text) :
result = "";
number = 0
counter = 0
for letter in text :
counter = counter + 1
if letter != '.' and counter is not len(text) :
result = result + letter
number = letter
else :
if counter is len(text) :
result += letter
match(number):
case 1:
result = result + "st"
case 2:
result = result + "nd"
case 3:
result = result + "rd"
case _:
result = result + "th"
if counter is not len(text) :
result += " of the "
return result
..sFF..F
======================================================================
FAIL: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
AssertionError: '2th of the 2th of the 2th of the 2th' != '2nd of the 2nd of the 2nd of the 2nd'
- 2th of the 2th of the 2th of the 2th
?  ^^         ^^         ^^         ^^
+ 2nd of the 2nd of the 2nd of the 2nd
?  ^^         ^^         ^^         ^^


======================================================================
FAIL: test_other_than_teens (test.TestSuffixOrdinals)
Test elements other than teens (11-19).
----------------------------------------------------------------------
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
AssertionError: '21th of the 32th of the 43th of the 56th of[39 chars]56th' != '21st of the 32nd of the 43rd of the 56th of[39 chars]56th'
- 21th of the 32th of the 43th of the 56th of the 165th of the 12342th of the 12344556th
?    -          ^^          ^^                                      ^^
+ 21st of the 32nd of the 43rd of the 56th of the 165th of the 12342nd of the 12344556th
?   +           ^^          ^^                                      ^^


======================================================================
FAIL: test_special_digits (test.TestSuffixOrdinals)
Test all special digits.
----------------------------------------------------------------------
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
AssertionError: '1th of the 2th of the 3th' != '1st of the 2nd of the 3rd'
- 1th of the 2th of the 3th
?   -         ^^         ^^
+ 1st of the 2nd of the 3rd
?  +          ^^         ^^


----------------------------------------------------------------------
Ran 8 tests in 0.082s

FAILED (failures=3, skipped=1)
Петър Петров
  • Некоректно
  • 7 успешни тест(а)
  • 1 неуспешни тест(а)
Петър Петров
def suffix_ordinals(numbers):
result_string = ""
for index, number in enumerate(numbers.split('.')):
if 11 <= int(number) <= 19:
number += 'th'
elif number[-1] == '1':
number += 'st'
elif number[-1] == '2':
number += 'nd'
elif number[-1] == '3':
number += 'rd'
else:
number += 'th'
if index != 0:
result_string += " of the " + number
else:
result_string += number
return result_string
.Fs.....
======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd
?    -            ^^                    ^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


----------------------------------------------------------------------
Ran 8 tests in 0.079s

FAILED (failures=1, skipped=1)
Радостин Маринов
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Радостин Маринов
def add_suffix(number_str):
last_two_digits = number_str[-2:]
if last_two_digits == "11" or last_two_digits == "12" or last_two_digits == "13":
return f"{number_str}th"
last_digit = number_str[-1]
if last_digit == "1":
return f"{number_str}st"
if last_digit == "2":
return f"{number_str}nd"
if last_digit == "3":
return f"{number_str}rd"
return f"{number_str}th"
def suffix_ordinals(input_str):
return " of the ".join(map(add_suffix, input_str.split(".")))
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.074s

OK (skipped=1)
Виктор Христов
  • Некоректно
  • 6 успешни тест(а)
  • 2 неуспешни тест(а)
Виктор Христов
def suffix_ordinals(numbers):
numbers = numbers.split('.')
def get_postfix(string):
if string == "11":
return "th"
elif string == "12":
return "th"
elif string == "13":
return "th"
match(string[-1]):
case '1':
if string[-2] == '1':
return "th"
else:
return "st"
case '2':
if string[-2] == '1':
return "th"
else:
return "nd"
case '3':
if string[-2] == '1':
return "th"
else:
return "rd"
case _:
return "th"
result = numbers[0] + get_postfix(numbers[0])
numbers = numbers[1:]
for number in numbers:
result += " of the " + number + get_postfix(number)
return result
..sE...E
======================================================================
ERROR: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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: string index out of range

======================================================================
ERROR: test_special_digits (test.TestSuffixOrdinals)
Test all special digits.
----------------------------------------------------------------------
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: string index out of range

----------------------------------------------------------------------
Ran 8 tests in 0.078s

FAILED (errors=2, skipped=1)
Гергана Гочева
  • Некоректно
  • 4 успешни тест(а)
  • 4 неуспешни тест(а)
Гергана Гочева
def suffix_ordinals(words):
unpacked_words = words.split(".")
result = ""
for word in unpacked_words:
last_digit = word[-1]
if len(word) > 1 and word[-2] == '1':
result += word + 'th'
elif last_digit == "1":
result += word + 'st'
elif last_digit == '2':
result += word + 'nd'
elif last_digit == '3':
result += word + 'rd'
else:
result += word + 'th'
if word == words[-1]:
return result
result += ' of the '
FFsFF...
======================================================================
FAIL: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
AssertionError: None != '11th of the 12th of the 13th of the 14th[56 chars]19th'

======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: None != '111th of the 312th of the 998342421713th'

======================================================================
FAIL: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
AssertionError: '2nd' != '2nd of the 2nd of the 2nd of the 2nd'
- 2nd
+ 2nd of the 2nd of the 2nd of the 2nd


======================================================================
FAIL: test_other_than_teens (test.TestSuffixOrdinals)
Test elements other than teens (11-19).
----------------------------------------------------------------------
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
AssertionError: None != '21st of the 32nd of the 43rd of the 56th[42 chars]56th'

----------------------------------------------------------------------
Ran 8 tests in 0.079s

FAILED (failures=4, skipped=1)
Цветан Тошев
  • Некоректно
  • 2 успешни тест(а)
  • 6 неуспешни тест(а)
Цветан Тошев
def suffix_ordinals(with_points):
without_points = with_points.split(".")
ready_string = ""
suffix = {'1': 'st', '2': 'nd', '3': 'rd', '4': 'th','5': 'th',
'6': 'th', '7': 'th', '8': 'th', '9': 'th','0': 'th'}
for part in without_points:
if len(part) < 2:
ready_string += part + (suffix[last_num] + " of the ")
elif part == without_points[-1]:
ready_string += part + suffix[last_num]
else:
last_num = part[len(part) - 1]
second_to_last = part[len(part) - 2]
if second_to_last == '1':
ready_string += part + "th of the "
else:
ready_string += part + suffix[last_num] + " of the "
return ready_string
.FsEFEEE
======================================================================
ERROR: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
UnboundLocalError: local variable 'last_num' referenced before assignment

======================================================================
ERROR: test_regular_digits (test.TestSuffixOrdinals)
Test all regular digits.
----------------------------------------------------------------------
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
UnboundLocalError: local variable 'last_num' referenced before assignment

======================================================================
ERROR: test_single_number (test.TestSuffixOrdinals)
Test with single number.
----------------------------------------------------------------------
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
UnboundLocalError: local variable 'last_num' referenced before assignment

======================================================================
ERROR: test_special_digits (test.TestSuffixOrdinals)
Test all special digits.
----------------------------------------------------------------------
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
UnboundLocalError: local variable 'last_num' referenced before assignment

======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111th of the 312th of the 998342421713nd' != '111th of the 312th of the 998342421713th'
- 111th of the 312th of the 998342421713nd
?                                       ^^
+ 111th of the 312th of the 998342421713th
?                                       ^^


======================================================================
FAIL: test_other_than_teens (test.TestSuffixOrdinals)
Test elements other than teens (11-19).
----------------------------------------------------------------------
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
AssertionError: '21st[20 chars]43rd of the 56th of the 165th of the 12342nd of the 12344556nd' != '21st[20 chars]43rd of the 56th of the 165th of the 12342nd of the 12344556th'
- 21st of the 32nd of the 43rd of the 56th of the 165th of the 12342nd of the 12344556nd
?                                                                                     ^^
+ 21st of the 32nd of the 43rd of the 56th of the 165th of the 12342nd of the 12344556th
?                                                                                     ^^


----------------------------------------------------------------------
Ran 8 tests in 0.083s

FAILED (failures=2, errors=4, skipped=1)
Георги Събев
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Георги Събев
SUFFIXES = {
'1': 'st',
'2': 'nd',
'3': 'rd'
}
SPECIAL_NUMBERS = [11, 12, 13]
def ordinal(number):
suffix = 'th'
last_two_digits = int(number) % 100
if SUFFIXES.get(number[-1]) and last_two_digits not in SPECIAL_NUMBERS:
suffix = SUFFIXES[number[-1]]
return number + suffix
def suffix_ordinals(numbers):
separated_numbers = numbers.split('.')
ordinals = map(ordinal, separated_numbers)
return ' of the '.join(ordinals)
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.087s

OK (skipped=1)
Димитър Аврамов
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Димитър Аврамов
def suffix_ordinals(decimal_num):
special_nums_suffixes = {'1': 'st', '2': 'nd', '3': 'rd'}
nums = decimal_num.split('.')
result = []
for num in nums:
current = num
last_digit = num[len(num) - 1]
if num in special_nums_suffixes:
current += special_nums_suffixes[last_digit]
elif last_digit in special_nums_suffixes and num[len(num) - 2] != '1':
current += special_nums_suffixes[last_digit]
else:
current += 'th'
result.append(current)
seperator = ' of the '
return seperator.join(result)
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.084s

OK (skipped=1)
Тина Томова
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Тина Томова
def suffix_ordinals(numbers):
suffixes = ("th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th")
numbers_split = numbers.split(".")
result = numbers_split[0]
if len(numbers_split[0]) > 1 and numbers_split[0][-2] == "1":
result += "th"
else:
result += suffixes[int(numbers_split[0][-1])]
if len(numbers_split) == 1:
return result
for number in numbers_split[1:]:
result += f" of the {number}"
if len(number) > 1 and number[-2] == "1":
result += "th"
else:
result += suffixes[int(number[-1])]
return result
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.083s

OK (skipped=1)
Айше Джинджи
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Айше Джинджи
def add_suffix(number):
last_digit = int(number) % 10
last_two_digits = int(number) % 100
if last_digit == 1 and last_two_digits != 11:
return number + 'st'
elif last_digit == 2 and last_two_digits != 12:
return number + 'nd'
elif last_digit == 3 and last_two_digits != 13:
return number + 'rd'
return number + 'th'
def suffix_ordinals(numbers):
return ' of the '.join(map(add_suffix, numbers.split('.')))
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.081s

OK (skipped=1)
Даниела Дишлянова
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Даниела Дишлянова
def suffix_ordinals(numbers):
number_container = numbers.split('.')
ordinals=[]
for number in number_container:
if (number[-1] in ('1', '2', '3'))and(len(number) == 1 or number[-2] != '1'):
if number[-1] == '1':
ordinals.append(number + 'st')
elif number[-1] == '2':
ordinals.append(number + 'nd')
elif number[-1] == '3':
ordinals.append(number + 'rd')
else:
ordinals.append(number + 'th')
return ' of the '.join(ordinals)
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.084s

OK (skipped=1)
Румен Тошев
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Румен Тошев
def suffix_ordinals(data_to_transfer):
final_text = []
suffix_of_nums = {"1": "st", "2": "nd", "3": "rd"}
splitted_sections_of_nums = data_to_transfer.split(".")
for section in splitted_sections_of_nums:
temp_section = section
if len(section) > 1:
if temp_section[-2] == "1":
temp_section += "th"
else:
temp_section += suffix_of_nums.get(temp_section[-1], "th")
else:
temp_section += suffix_of_nums.get(temp_section[-1], "th")
final_text.append(temp_section)
return " of the ".join(final_text)
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.075s

OK (skipped=1)
Георги
  • Некоректно
  • 0 успешни тест(а)
  • 0 неуспешни тест(а)
Георги
pass
cannot import name 'suffix_ordinals' from 'solution' (/tmp/d20221029-351493-10r9tz2/solution.py)
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 114, in main
    loaded_test = importlib.import_module('test', test_module)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/tmp/d20221029-351493-10r9tz2/test.py", line 3, in <module>
    from solution import suffix_ordinals
Мария Симеонова
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Мария Симеонова
def suffix_ordinals(given_numbers):
numbers = given_numbers.split(".")
result = ""
ordinal_numbers = []
for number in numbers:
last_digit = int(number) % 10
if last_digit == 1:
if int(number) % 100 == 11:
number += "th"
ordinal_numbers.append(number)
else:
number += "st"
ordinal_numbers.append(number)
elif last_digit == 2:
if int(number) % 100 == 12:
number += "th"
ordinal_numbers.append(number)
else:
number += "nd"
ordinal_numbers.append(number)
elif last_digit == 3:
if int(number) % 100 == 13:
number += "th"
ordinal_numbers.append(number)
else:
number += "rd"
ordinal_numbers.append(number)
else:
number += "th"
ordinal_numbers.append(number)
current_index = 0
for number in ordinal_numbers:
result += number
if current_index is not len(ordinal_numbers) - 1:
result += " of the "
current_index += 1
return result
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.084s

OK (skipped=1)
Минчо Христов
  • Некоректно
  • 7 успешни тест(а)
  • 1 неуспешни тест(а)
Минчо Христов
def add_suffix(num):
size = len(num)
last_digit = num[size - 1]
second_to_last = num[size - 2]
if (
(second_to_last == "1" and last_digit == "1")
or (second_to_last == "1" and last_digit == "2")
or (second_to_last == "1" and last_digit == "3")
):
num += "th"
elif last_digit == "1":
num += "st"
elif last_digit == "2":
num += "nd"
elif last_digit == "3":
num += "rd"
else:
num += "th"
return num
def suffix_ordinals(numb_str):
numb_lst = numb_str.split(".")
c1 = 0
size = len(numb_lst)
last_str = ""
if size == 0:
return None
for numb in numb_lst:
last_str += "{}".format(add_suffix(numb))
c1 += 1
if c1 < size:
last_str += " of the "
return last_str
..s....F
======================================================================
FAIL: test_special_digits (test.TestSuffixOrdinals)
Test all special digits.
----------------------------------------------------------------------
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
AssertionError: '1th of the 2nd of the 3rd' != '1st of the 2nd of the 3rd'
- 1th of the 2nd of the 3rd
?   -
+ 1st of the 2nd of the 3rd
?  +


----------------------------------------------------------------------
Ran 8 tests in 0.078s

FAILED (failures=1, skipped=1)
Георги Чобанов
  • Некоректно
  • 6 успешни тест(а)
  • 2 неуспешни тест(а)
Георги Чобанов
def suffix_ordinals(ordinals):
number_to_suffix_dict = {
"1" : "st",
"2" : "nd",
"3" : "rd"
}
numbers = ordinals.split('.')
final_string = ""
for number in numbers:
suffix = "th"
last_digit = number[len(number) - 1]
if last_digit in number_to_suffix_dict:
suffix = number_to_suffix_dict[last_digit]
final_string = f"{final_string} {number}{suffix} of the"
final_string = final_string[1:(len(final_string) - 7)]
return final_string;
FFs.....
======================================================================
FAIL: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
AssertionError: '11st of the 12nd of the 13rd of the 14th of[53 chars]19th' != '11th of the 12th of the 13th of the 14th of[53 chars]19th'
- 11st of the 12nd of the 13rd of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?   -           ^^          ^^
+ 11th of the 12th of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?    +          ^^          ^^


======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd
?    -            ^^                    ^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


----------------------------------------------------------------------
Ran 8 tests in 0.079s

FAILED (failures=2, skipped=1)
Мариян Христов
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Мариян Христов
def number_suffix(number):
if number in (11, 12, 13):
return "th"
number %=10
if number == 1:
return "st"
elif number == 2:
return "nd"
elif number == 3:
return "rd"
else:
return "th"
def suffix_ordinals(string):
split_string = string.split(".")
for index, number in enumerate(split_string):
split_string[index] += number_suffix(int(number) % 100)
return " of the ".join(split_string)
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.074s

OK (skipped=1)
Клементина Картевска
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Клементина Картевска
def suffix_ordinals(numbers):
munbers = numbers.split(".")
ans = []
for number in munbers:
if number == '':
continue
if number[-2:] == '11' or number[-2:] == '12' or number[-2:] == '13':
ans.append(number + 'th')
elif number[-1] == '1':
ans.append(number + 'st')
elif number[-1] == '2':
ans.append(number + 'nd')
elif number[-1] == '3':
ans.append(number + 'rd')
else:
ans.append(number + 'th')
return " of the ".join(ans)
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.082s

OK (skipped=1)
Теодора Петкова
  • Некоректно
  • 7 успешни тест(а)
  • 1 неуспешни тест(а)
Теодора Петкова
def suffix(num):
match num[-1]:
case "1":
return num + "st"
case "2":
return num + "nd"
case "3":
return num + "rd"
case _:
return num + "th"
def suffix_ordinals(nums):
numbers = nums.split(".")
output = ""
for n in numbers:
if len(n) > 1:
if n[-2] == "1":
output += n + "th"
else:
output += suffix(n)
else:
output += suffix(n)
if n is not numbers[-1]:
output += " of the "
# print(output)
return output
..sF....
======================================================================
FAIL: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
AssertionError: '2nd2nd2nd2nd' != '2nd of the 2nd of the 2nd of the 2nd'
- 2nd2nd2nd2nd
+ 2nd of the 2nd of the 2nd of the 2nd


----------------------------------------------------------------------
Ran 8 tests in 0.085s

FAILED (failures=1, skipped=1)
Йоанна Кръстева
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Йоанна Кръстева
def suffix_ordinals(dot_separated_numbers):
numbers_as_strings = dot_separated_numbers.split('.')
numbers_as_integers = list(map(int, numbers_as_strings))
i = 0
suffixes = ('th', 'st', 'nd', 'rd', 'th', 'th', 'th',
'th', 'th', 'th', 'th', 'th', 'th', 'th')
for number in numbers_as_integers:
index_of_suffix = number % 100
if index_of_suffix > 13:
numbers_as_strings[i] = f'{number}{suffixes[index_of_suffix % 10]}'
else:
numbers_as_strings[i] = f'{number}{suffixes[index_of_suffix]}'
i += 1
suffixed_numbers = ""
for index_, string_ in enumerate(numbers_as_strings):
if index_ != len(numbers_as_strings) - 1:
string_ = string_ + " of the "
suffixed_numbers += string_
else:
suffixed_numbers += string_
return suffixed_numbers
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.083s

OK (skipped=1)
Мария Марковска
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Мария Марковска
def suffix_ordinals(str_numbers):
numbers=str_numbers.split('.')
rez=""
not_first_el=0
for num in numbers:
if not_first_el==1:
rez+=' of the '
rez+=num
last_char=num[-1]
blast_char=num[len(num)-2]
if (last_char=='1' and blast_char!='1') or (last_char=='1' and len(num)==1):
rez+='st'
elif (last_char=='2' and blast_char!='1') or (last_char=='2' and len(num)==1):
rez+='nd'
elif (last_char=='3' and blast_char!='1') or (last_char=='3' and len(num)==1):
rez+='rd'
else:
rez+='th'
not_first_el=1
return rez
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.073s

OK (skipped=1)
Кристиан Иванов
  • Некоректно
  • 7 успешни тест(а)
  • 1 неуспешни тест(а)
Кристиан Иванов
def digits_ordinal(number):
digits_len = len(number) - 1
if number[digits_len] == '1':
if number[digits_len-1] == '1':
number += 'th'
else:
number += 'st'
elif number[digits_len] == '2':
if number[digits_len-1] == '1':
number += 'th'
else:
number += 'nd'
elif number[digits_len] == '3':
if number[digits_len-1] == '1':
number += 'th'
else:
number += 'rd'
else:
number += 'th'
return number
def suffix_ordinals(numbers):
ordinal_form = ''
for i in range(0, len(numbers)):
if numbers[i] == '.':
ordinal_form = digits_ordinal(ordinal_form)
ordinal_form += ' of the '
else:
ordinal_form += numbers[i]
ordinal_form = digits_ordinal(ordinal_form)
return ordinal_form
..s....F
======================================================================
FAIL: test_special_digits (test.TestSuffixOrdinals)
Test all special digits.
----------------------------------------------------------------------
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
AssertionError: '1th of the 2nd of the 3rd' != '1st of the 2nd of the 3rd'
- 1th of the 2nd of the 3rd
?   -
+ 1st of the 2nd of the 3rd
?  +


----------------------------------------------------------------------
Ran 8 tests in 0.080s

FAILED (failures=1, skipped=1)
Йоан Христов
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Йоан Христов
def suffix_ordinals(input_string):
list_of_strings = input_string.split(".")
output_string = ""
for elem in list_of_strings:
output_string += elem
units = int(elem) % 10
dozens = int(elem) % 100
if (units == 1 and dozens != 11):
output_string += "st"
elif (units == 2 and dozens != 12):
output_string += "nd"
elif (units == 3 and dozens != 13):
output_string += "rd"
else:
output_string += "th"
output_string += " of the "
return output_string[:-8]
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.081s

OK (skipped=1)
Адриана Атанасова
  • Некоректно
  • 6 успешни тест(а)
  • 2 неуспешни тест(а)
Адриана Атанасова
def suffix_ordinals(string):
lis = string.split('.')
result = ""
if len(lis) == 1:
number = int(lis[0])
if number == 11:
result = result + lis[0] + "th"
elif number == 1:
result = result + lis[0] + "st"
elif number == 2:
result = result + lis[0] + "nd"
elif number == 3:
result = result + lis[0] + "rd"
else:
result = result + lis[0] + "th"
else:
for i in lis[0:len(lis)-1]:
number = int(i)
temp = number % 10
if number == 11:
result = result + i + "th of the "
elif temp == 1:
result = result + i + "st of the "
elif temp == 2:
result = result + i + "nd of the "
elif temp == 3:
result = result + i + "rd of the "
else:
result = result + i + "th of the "
number = int(lis[len(lis)-1])
temp = number % 10
if number == 11:
result = result + lis[len(lis) - 1] + "th"
elif temp == 1:
result = result + lis[len(lis) - 1] + "st"
elif temp == 2:
result = result + lis[len(lis) - 1] + "nd"
elif temp == 3:
result = result + lis[len(lis) - 1] + "rd"
else:
result = result + lis[len(lis) - 1] + "th"
return result
FFs.....
======================================================================
FAIL: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
AssertionError: '11th of the 12nd of the 13rd of the 14th of the 15th of[41 chars]19th' != '11th of the 12th of the 13th of the 14th of the 15th of[41 chars]19th'
- 11th of the 12nd of the 13rd of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?               ^^          ^^
+ 11th of the 12th of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?               ^^          ^^


======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd
?    -            ^^                    ^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


----------------------------------------------------------------------
Ran 8 tests in 0.083s

FAILED (failures=2, skipped=1)
Рая Симеонова
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Рая Симеонова
def suffix_ordinals(string):
separated_nums = string.split('.')
suffixed_nums = ''
is_first_iteration = True
for num in separated_nums:
if not is_first_iteration:
suffixed_nums += ' of the '
else:
is_first_iteration = False
last_digit = int(num) % 10
last_two_digits = int(num) % 100
if last_digit == 1 and last_two_digits != 11:
suffix = 'st'
elif last_digit == 2 and last_two_digits != 12:
suffix = 'nd'
elif last_digit == 3 and last_two_digits != 13:
suffix = 'rd'
else:
suffix = 'th'
suffixed_nums += (num + suffix)
return suffixed_nums
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.075s

OK (skipped=1)
Валерия Стояновска
  • Некоректно
  • 6 успешни тест(а)
  • 2 неуспешни тест(а)
Валерия Стояновска
def suffix_ordinals(numbers):
list_of_numbers = numbers.split(".")
text = ""
for element in list_of_numbers:
last_digit = element[-1]
if element in ('11', '12', '13'):
text += element + 'th'
elif last_digit == '1':
text += element + 'st'
elif last_digit == '2':
text += element + 'nd'
elif last_digit == '3':
text += element + 'rd'
else:
text += element + 'th'
if element != list_of_numbers[-1]:
text += ' of the '
return text
.FsF....
======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd
?    -            ^^                    ^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


======================================================================
FAIL: test_multiple_numbers (test.TestSuffixOrdinals)
Test with multiple number.
----------------------------------------------------------------------
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
AssertionError: '2nd2nd2nd2nd' != '2nd of the 2nd of the 2nd of the 2nd'
- 2nd2nd2nd2nd
+ 2nd of the 2nd of the 2nd of the 2nd


----------------------------------------------------------------------
Ran 8 tests in 0.083s

FAILED (failures=2, skipped=1)
Надежда Панделиева
  • Некоректно
  • 6 успешни тест(а)
  • 2 неуспешни тест(а)
Надежда Панделиева
def suffix_ordinals(num):
list_of_numbers = []
for x in num.split("."):
if x[-1] in ("0", "4", "5", "6", "7", "8", "9"):
list_of_numbers.append(x + "th")
elif x[-1] == "1":
list_of_numbers.append(x + "st")
elif x[-1] == "2":
list_of_numbers.append(x + "nd")
else:
list_of_numbers.append(x + "rd")
return " of the ".join(list_of_numbers)
FFs.....
======================================================================
FAIL: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
AssertionError: '11st of the 12nd of the 13rd of the 14th of[53 chars]19th' != '11th of the 12th of the 13th of the 14th of[53 chars]19th'
- 11st of the 12nd of the 13rd of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?   -           ^^          ^^
+ 11th of the 12th of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?    +          ^^          ^^


======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd
?    -            ^^                    ^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


----------------------------------------------------------------------
Ran 8 tests in 0.081s

FAILED (failures=2, skipped=1)
Александра Радева
  • Некоректно
  • 6 успешни тест(а)
  • 2 неуспешни тест(а)
Александра Радева
def suffix_ordinals(numbers):
numbers+='!'
ordinals=""
for num in numbers:
if num == '.' or num == '!' :
if ordinals[-1] == '1' :
if len(ordinals) > 1 :
if ordinals[-2] == '1' :
ordinals+="th"
else : ordinals+="st"
else : ordinals+="st"
elif ordinals[-1] == '2' :
if len(ordinals) > 1 :
if ordinals[-2] == '1' :
ordinals+="th "
else : ordinals+="nd"
else : ordinals+="nd"
elif ordinals[-1] == '3' :
if len(ordinals) > 1 :
if ordinals[-2] == '1' :
ordinals+="th"
else : ordinals+="rd"
else : ordinals+="rd"
else : ordinals+="th"
if num != '!' : ordinals+=" of the "
else: ordinals+=num
return ordinals
FFs.....
======================================================================
FAIL: test_clean_teens (test.TestSuffixOrdinals)
Test clean teens (exactly between 11-19).
----------------------------------------------------------------------
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
AssertionError: '11th of the 12th  of the 13th of the 14th of the 15th of t[39 chars]19th' != '11th of the 12th of the 13th of the 14th of the 15th of th[38 chars]19th'
- 11th of the 12th  of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th
?                  -
+ 11th of the 12th of the 13th of the 14th of the 15th of the 16th of the 17th of the 18th of the 19th


======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111th of the 312th  of the 998342421713th' != '111th of the 312th of the 998342421713th'
- 111th of the 312th  of the 998342421713th
?                    -
+ 111th of the 312th of the 998342421713th


----------------------------------------------------------------------
Ran 8 tests in 0.084s

FAILED (failures=2, skipped=1)
Огнян Йончев
  • Некоректно
  • 7 успешни тест(а)
  • 1 неуспешни тест(а)
Огнян Йончев
def suffix_ordinals(string_of_numbers):
number_size = 0
suffix_string = ''
index = 0
for element in string_of_numbers:
if element != '.':
number_size += 1
suffix_string += element
if index == len(string_of_numbers) - 1:
if string_of_numbers[index - 1] == '1' and number_size == 2:
suffix_string += 'th'
elif string_of_numbers[index] == '1':
suffix_string += 'st'
elif string_of_numbers[index] == '2':
suffix_string += 'nd'
elif string_of_numbers[index] == '3':
suffix_string += 'rd'
else:
suffix_string += 'th'
number_size = 0
elif element == '.':
if string_of_numbers[index - 2] == '1' and number_size == 2:
suffix_string += 'th of the '
elif string_of_numbers[index - 1] == '1':
suffix_string += 'st of the '
elif string_of_numbers[index - 1] == '2':
suffix_string += 'nd of the '
elif string_of_numbers[index - 1] == '3':
suffix_string += 'rd of the '
else:
suffix_string += 'th of the '
number_size = 0
index += 1
return suffix_string
.Fs.....
======================================================================
FAIL: test_complex_teens (test.TestSuffixOrdinals)
Test complex teens (100+ ending with a teen).
----------------------------------------------------------------------
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
AssertionError: '111st of the 312nd of the 998342421713rd' != '111th of the 312th of the 998342421713th'
- 111st of the 312nd of the 998342421713rd
?    -            ^^                    ^^
+ 111th of the 312th of the 998342421713th
?     +           ^^                    ^^


----------------------------------------------------------------------
Ran 8 tests in 0.075s

FAILED (failures=1, skipped=1)
Александра Христова
  • Коректно
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)
Александра Христова
"""Challenge 01 module for fmi-intro-to-python-2022"""
def suffix_ordinals(input_value):
"""Ordinal numbers representation"""
return " of the ".join([(lambda n: "%d%s" % (n,('th', 'st', 'nd', 'rd')[(n//10%10!=1)*(n%10<4)*n%10]))(int(x)) for x in input_value.split('.')])
..s.....
----------------------------------------------------------------------
Ran 8 tests in 0.082s

OK (skipped=1)