python_math_stat/practica/stepik/stepik_tasks/tickets.py
2023-10-06 22:48:22 +03:00

29 lines
657 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# #zadachya s biletom
bilet_num = list(int(value) for value in input())
Sum = 0
Sum_1 = 0
for num in bilet_num[:3]:
Sum = Sum + num
for num in bilet_num[3:]:
Sum_1 = Sum_1 + num
if Sum == Sum_1:
print ("Счастливый")
else:
print("Обычный")
# другой вариант / задача с билетом
bilet_num = [int(value) for value in input()]
Sum = 0
Sum2 = 0
for num in bilet_num:
Sum += (int(str(num)[0:3]))
print (num)
for num in bilet_num:
print (num)
Sum2 += (int(str(num)[3:]))
if Sum == Sum2:
print('Счастливый')
else:
print ('Обычный')