Codechef Problem: Counting Pretty Numbers Difficulty Rating:873
.png)
Problem Vasya likes the number 239 239 . Therefore, he considers a number pretty if its last digit is 2 2 , 3 3 or 9 9 . Vasya wants to watch the numbers between � L and � R (both inclusive), so he asked you to determine how many pretty numbers are in this range. Can you help him? Input The first line of the input contains a single integer � T denoting the number of test cases. The description of � T test cases follows. The first and only line of each test case contains two space-separated integers � L and � R . Output For each test case, print a single line containing one integer — the number of pretty numbers between � L and � R . Solution: # cook your dish here def is_pretty(number): last_digit = number % 10 return last_digit == 2 or last_digit == 3 or last_digit == 9 def count_pretty_numbers_in_range(L, R): cou...