-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathBeautifulDaysAtTheMovies.py
More file actions
47 lines (33 loc) · 920 Bytes
/
Copy pathBeautifulDaysAtTheMovies.py
File metadata and controls
47 lines (33 loc) · 920 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
37
38
39
40
41
42
43
44
45
46
47
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'beautifulDays' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. INTEGER i
# 2. INTEGER j
# 3. INTEGER k
#
def beautifulDays(i, j, k):
# Write your code here
beautiful_count = 0
for day in range(i, j + 1):
reverse_day = int(str(day)[::-1])
difference = abs(day - reverse_day)
if difference % k == 0:
beautiful_count += 1
return beautiful_count
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
first_multiple_input = input().rstrip().split()
i = int(first_multiple_input[0])
j = int(first_multiple_input[1])
k = int(first_multiple_input[2])
result = beautifulDays(i, j, k)
fptr.write(str(result) + '\n')
fptr.close()