SimeonTs

SUPyF2 Functions-Exercise - 03. Characters in Range

Oct 8th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. """
  2. Functions - Exercise
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1728#2
  4.  
  5. SUPyF2 Functions-Exercise - 03. Characters in Range
  6.  
  7. Problem:
  8. Write a function that receives two characters and returns a single string with all the
  9. characters in between them according to the ASCII code.
  10. Examples:
  11. Input:      Output:
  12. a
  13. d           b c
  14.  
  15. #
  16. :           $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9
  17.  
  18. C
  19. #           $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B
  20. """
  21.  
  22.  
  23. def char_in_range(char_1, char_2):
  24.     all_characters = []
  25.     for character in range((ord(char_1) + 1), ord(char_2)):
  26.         all_characters += [chr(character)]
  27.     return " ".join(all_characters)
  28.  
  29.  
  30. print(char_in_range(input(), input()))
Add Comment
Please, Sign In to add comment