Advertisement
KNenov96

06. Barcode Generator. PB Exam Python 18 and 19 July

May 27th, 2022
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. barcode_start = int(input())
  2. barcode_finish = int(input())
  3.  
  4. number_thousand = barcode_start // 1000
  5. number_thousand_finish = barcode_finish // 1000
  6. number_hunderd = barcode_start // 100
  7. number_hunderd %= 10
  8. number_hunder_finish = barcode_finish // 100
  9. number_hunder_finish %= 10
  10. number_ten = barcode_start // 10
  11. number_ten %= 10
  12. number_ten_finish = barcode_finish // 10
  13. number_ten_finish %= 10
  14. number_one = barcode_start % 10
  15. number_one_finish = barcode_finish % 10
  16.  
  17. for thousend_position in range(number_thousand, number_thousand_finish +1):
  18.     for hundred_position in range(number_hunderd, number_hunder_finish + 1):
  19.         for ten_position in range(number_ten, number_ten_finish + 1):
  20.             for one_position in range(number_one, number_one_finish + 1):
  21.                 if thousend_position % 2 == 1 and \
  22.                     hundred_position % 2 == 1 and \
  23.                     ten_position % 2 == 1 and \
  24.                     one_position % 2 == 1:
  25.                     print(f"{thousend_position}{hundred_position}{ten_position}{one_position}", end=" ")
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement