-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlection_3.py
More file actions
36 lines (31 loc) · 931 Bytes
/
lection_3.py
File metadata and controls
36 lines (31 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
''' DRY '''
'''
'''
def is_some(number: int, count: int) -> bool:
'''Функция возвращает результат проверки является ли число n разрядным
:number: int число
:count: int количество разрядов
:return: bool:
'''
return 1 <= (number // 10 ** (count -1)) < 10
a: bool = is_some(123, 3) #аннотация
b: float = is_some(123, 4) #аннотация не влияет на выполнение
c = is_some(12, 5)
d = is_some(124523446, 6)
print(a, b, c, d)
print(any((a, b, c, d)))
print(all((a, b, c, d)))
#
def some(number):
# как использовать Степень делимого для определения условия ?
'''
>>> some(34235253)
NO
>>> some(53)
NO
>>> some(353)
YES
'''
answer = ('NO','YES')
print(answer[1 <= (number // 100) < 10])
some(353)