Distance From Limit
This function helps you practice finding the distance between numbers and applying a special rule above a boundary. Write a function diff21 that takes an integer n and returns the absolute difference between n and 21. If n is greater than 21, return double that difference.
Примеры
Ввод
19Вывод
2Ввод
10Вывод
11Ввод
21Вывод
0Нужно реализовать
def diff21(n: int) -> int:
Теги
math
Logáil isteach chun stair na n-aighneachtaí a fheiceáil
Logáil isteachLogáil isteach chun an Meantóir IS a úsáid
Logáil isteachVisible tests
1
Input
19Expected
22
Input
10Expected
113
Input
21Expected
04
Input
22Expected
25
Input
25Expected
86
Input
2Expected
19Focus radio
Paused · SomaFM · Fluid