You are viewing a single comment's thread. Return to all comments →

Nice solution! Here is my not so elegant solution, however maybe easier to understand for beginners..

i,j,k = [int(x) for x in input().split()] count = 0 for x in range(i,j+1): if (x - int(str(x)[::-1])) % k == 0: count += 1 print(count)

I have done the same thing, python is amazing.....

Whoa!

my code exactly

Cool, mine is the same!!

def beautifulDays(i, j, k): return sum ([1 for i in range(i, j + 1) if (int(str(i)[::-1]) - i) % k == 0])

I don't quite understand what you are saying in the conditional statement. Can you explain?

I am checking if the difference between number and reversed number is evenly divisible by k or not.

## Beautiful Days at the Movies

You are viewing a single comment's thread. Return to all comments →

Nice solution! Here is my not so elegant solution, however maybe easier to understand for beginners..

I have done the same thing, python is amazing.....

Whoa!

my code exactly

Cool, mine is the same!!

I don't quite understand what you are saying in the conditional statement. Can you explain?

I am checking if the difference between number and reversed number is evenly divisible by k or not.