SimeonTs

SUPyF2 Basic Exercise - 06. Next Happy Year

Sep 24th, 2019
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. """
  2. Basic Syntax, Conditional Statements and Loops - Exercise
  3. Check your code: https://judge.softuni.bg/Contests/Compete/Index/1719#5
  4. Video: https://www.youtube.com/watch?time_continue=4&v=7sHE4HEUqi8
  5.  
  6. SUPyF2 Basic Exercise - 06. Next Happy Year
  7.  
  8. Problem:
  9. You're saying good-bye your best friend, "See you next happy year". Happy Year is the year with only distinct digits,
  10. (e.g) 2018. Write a program that receives an integer number and finds the next happy year.
  11.  
  12. Examples:
  13. Input   Output
  14. 8989    9012
  15. 1001    1023
  16.  
  17. """
  18. year = int(input()) + 1
  19.  
  20. while True:
  21.     if len(set(str(year))) == len(str(year)):
  22.         print(year)
  23.         break
  24.     else:
  25.         year += 1
Add Comment
Please, Sign In to add comment