Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num1 = int(input())
- num2 = int(input())
- is_all_number_printed = False
- for number in range(num1, num2 + 1):
- number_str = str(number)
- odd_sum = 0
- even_sum = 0
- for position, current_digit_in_number in enumerate(number_str): # position = 0 (1st position)
- if position % 2 == 0: # position = 1 (2nd position)
- odd_sum += int(current_digit_in_number) # position = 2 (3th position)
- elif position % 2 != 0: # pos..etc = 5 (6th position)
- even_sum += int(current_digit_in_number)
- if even_sum == odd_sum:
- print(number, end=' ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement