We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0563d1a commit 8e34b76Copy full SHA for 8e34b76
1 file changed
lesson03/home_work/hw03_easy.py
@@ -6,7 +6,7 @@
6
7
8
def my_round(n, nd):
9
- s = round(n,nd)
+ s = float("{0:.{nd}f}".format(n,nd=nd))
10
return s
11
12
@@ -22,9 +22,21 @@ def my_round(n, nd):
22
# !!!P.S.: функция не должна НИЧЕГО print'ить
23
24
def lucky_ticket(ticket_number):
25
- pass
26
-
27
+ repr_tic_num = repr(ticket_number)
+ if len(repr_tic_num) == 6:
+ left = repr_tic_num[:3]
28
+ right = repr_tic_num[-3:]
29
+ def sum_side(side):
30
+ s = 0
31
+ for i in side:
32
+ s+=int(i)
33
+ return s
34
+ if sum_side(left)== sum_side(right):
35
+ return "true"
36
+ else:
37
+ return "false"
38
39
+ return "Билет не шестизначный"
40
print(lucky_ticket(123006))
41
print(lucky_ticket(12321))
42
print(lucky_ticket(436751))
0 commit comments