SimeonTs

SUPyF2 Lists-Advanced-Exercise - 03. Next Version

Oct 10th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. """
  2. Lists Advanced - Exercise
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1731#2
  4.  
  5. SUPyF2 Lists-Advanced-Exercise - 03. Next Version
  6.  
  7. Problem:
  8. You're fed up about changing the version of your software manually.
  9. Instead, you will create a little script that will make it for you.
  10. You will be given a version as in this example: "1.3.4".
  11. You have to find the next version and print it ("1.3.5" from the example).
  12. The only rule is that the numbers cannot be greater than 9.
  13. If that happens, set the current number to 0 and increase the number before it.
  14. For more clarification, see the examples. Note: there will be no case where the first number will get greater than 9
  15.  
  16. Example
  17. Input   Output
  18. 1.2.3   1.2.4
  19. 1.3.9   1.4.0
  20. 3.9.9   4.0.0
  21. """
  22. nums_list = [digit for digit in input().split(".")]
  23. number = ""
  24. for num in nums_list:
  25.     number += num
  26. print(".".join([digit for digit in str(int(number) + 1)]))
Add Comment
Please, Sign In to add comment