Advertisement
PowerCell46

Next happy year Python

Dec 23rd, 2022
1,163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. current_year = int(input())
  2. print_it = False
  3.  
  4. while True:
  5.     list = []
  6.     current_year += 1
  7.     current_year = str(current_year)
  8.     for index in range(0, len(current_year)):
  9.         current_digit = current_year[index]
  10.         list.append(current_digit)
  11.  
  12.     for i in range(0, len(list)):
  13.         current_digit = list[i]
  14.         result = list.count(current_digit)
  15.         if result > 1:
  16.             print_it = False
  17.             break
  18.         else:
  19.             print_it = True
  20.  
  21.     if print_it == True:
  22.         print(current_year)
  23.         break
  24.     current_year = int(current_year)
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement