Advertisement
Spocoman

03. Characters in Range

Jan 28th, 2022
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. first = input()
  2. second = input()
  3.  
  4.  
  5. def solve():
  6.     result = ''
  7.     for i in range(ord(first) + 1, ord(second)):
  8.         result += f'{chr(i)} '
  9.     return result
  10.  
  11.  
  12. print(solve())
  13.  
  14.  
  15. Решение с map() и join():
  16.  
  17. first = input()
  18. second = input()
  19.  
  20.  
  21. def solve():
  22.     return ' '.join(map(chr, range(ord(first) + 1, ord(second))))
  23.  
  24.  
  25. print(solve())
  26.  
  27. Или:
  28.  
  29. def solve():
  30.     return ' '.join(map(chr, range(ord(input()) + 1, ord(input()))))
  31.  
  32.  
  33. print(solve())
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement