Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- start_barcode = int(input())
- end_barcode = int(input())
- start_barcode_string = str(start_barcode)
- end_barcode_string = str(end_barcode)
- if int(start_barcode_string[3]) % 2 == 0:
- start_barcode += 1
- for each_barcode in range(start_barcode, end_barcode + 1, 2):
- string_barcode = str(each_barcode)
- a = int(string_barcode[0])
- b = int(string_barcode[1])
- c = int(string_barcode[2])
- d = int(string_barcode[3])
- if a % 2 == 1 and b % 2 == 1 and c % 2 == 1 and d % 2 == 1:
- if start_barcode_string[0] <= str(a) <= end_barcode_string[0]:
- if start_barcode_string[1] <= str(b) <= end_barcode_string[1]:
- if start_barcode_string[2] <= str(c) <= end_barcode_string[2]:
- if start_barcode_string[3] <= str(d) <= end_barcode_string[3]:
- print(string_barcode, end=' ')
- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- range_start = int(input())
- range_end = int(input())
- range_start_as_str = str(range_start)
- range_end_as_str = str(range_end)
- for barcode in range(range_start, range_end + 1):
- is_valid_barcode = True
- barcode_as_str = str(barcode)
- for index, digit in enumerate(barcode_as_str):
- if int(digit) % 2 == 0:
- is_valid_barcode = False
- break
- if int(digit) < int(range_start_as_str[index]):
- is_valid_barcode = False
- break
- if int(digit) > int(range_end_as_str[index]):
- is_valid_barcode = False
- break
- if is_valid_barcode:
- print(barcode, end=' ')
- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- start = int(input())
- end = int(input())
- thousands_start = start // 1000
- hundreds_start = start // 100 % 10
- tens_start = start // 10 % 10
- units_start = start % 10
- thousands_end = end // 1000
- hundreds_end = end // 100 % 10
- tens_end = end // 10 % 10
- units_end = end % 10
- for number1 in range(thousands_start, thousands_end + 1):
- for number2 in range(hundreds_start, hundreds_end + 1):
- for number3 in range(tens_start, tens_end + 1):
- for number4 in range(units_start, units_end + 1):
- if number1 % 2 == 1 and number2 % 2 == 1 and number3 % 2 == 1 and number4 % 2 == 1:
- print(f'{number1}{number2}{number3}{number4}', end=' ')
Advertisement
Add Comment
Please, Sign In to add comment