SimeonTs

SUPyF2 D.Types and Vars More Exercises - 04. Decrypting Mess

Sep 27th, 2019
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.12 KB | None | 0 0
  1. """
  2. Data Types and Variables - More Exercises
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1723#3
  4.  
  5. SUPyF2 D.Types and Vars More Exercises - 04. Decrypting Messages
  6.  
  7. Problem:
  8. You will receive a key (integer) and n characters afterward.
  9. Add the key to each of the characters and append them to a message.
  10. At the end print the message, which you decrypted.
  11. Input
  12. • On the first line, you will receive the key
  13. • On the second line, you will receive n – the number of lines, which will follow
  14. • On the next n lines – you will receive lower and uppercase characters from the Latin alphabet
  15. Output
  16. Print the decrypted message.
  17. Constraints
  18. • The key will be in the interval [0…20]
  19. • n will be in the interval [1…20]
  20. • The characters will always be upper or lower-case letters from the English alphabet
  21. • You will receive one letter per line
  22.  
  23. Examples:
  24. Input:
  25. 3
  26. 7
  27. P
  28. l
  29. c
  30. q
  31. R
  32. k
  33. f
  34. Output:
  35. SoftUni
  36.  
  37. Input:
  38. 1
  39. 7
  40. C
  41. d
  42. b
  43. q
  44. x
  45. o
  46. s
  47. Output:
  48. Decrypt
  49. """
  50. key = int(input())
  51. n = int(input())
  52. word = ""
  53.  
  54. for letter in range(n):
  55.     word += chr(ord(input()) + key)
  56.  
  57. print(word)
Add Comment
Please, Sign In to add comment