Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. from time import time
  2.  
  3. t_start = time()
  4.  
  5. start = int(input('Введіть початок діапазону: '))
  6. end = float(input('Введіть кінець діапазону: '))
  7.  
  8. end_int = int(end+1)
  9.  
  10.  
  11. for n in range(start, end_int):
  12.    
  13.     last_digit = n%10
  14.     print('last =', last_digit, 'n =', n)
  15.  
  16.    
  17.     i = 0
  18.     while n > 10:
  19.         first_digit = n = n/10
  20.         i += 1
  21.         print('first =', int(first_digit), 'n =', n)
  22.  
  23.    
  24.  
  25.         if first_digit == last_digit != 0:
  26.             print(n)
  27.  
  28.  
  29. t_finish = time() - t_start
  30. print('Витрачено', (t_finish*1000), 'мілісекунд')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement