17 lines
630 B
Python
17 lines
630 B
Python
def line_up(name, number):
|
|
ordinal_sufix: str = ""
|
|
# for the special case when the tenths of the number is between 10 and 20
|
|
# the ordinal of all numbers are equal to 'th'
|
|
if number % 100 > 10 and number % 100 < 20:
|
|
return f"{name}, you are the {number}th customer we serve today. Thank you!"
|
|
match number % 10:
|
|
case 1:
|
|
ordinal_sufix = "st"
|
|
case 2:
|
|
ordinal_sufix = "nd"
|
|
case 3:
|
|
ordinal_sufix = "rd"
|
|
case _:
|
|
ordinal_sufix = "th"
|
|
return f"{name}, you are the {number}{ordinal_sufix} customer we serve today. Thank you!"
|