Advertisement
UniQuet0p1

Untitled

Oct 18th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. """T04."""
  2.  
  3.  
  4. def make_hola_string(count: int) -> str:
  5. """
  6. Make hola string.
  7.  
  8. :param: number of holas
  9. :return:
  10. """
  11. return count * 'hola'
  12.  
  13.  
  14. def alphabet_index(letters, letter: str):
  15. """
  16. Find index.
  17.  
  18. :param letters: list, str
  19. :param letter: str
  20. :return: int
  21. """
  22. out = 'Letter not found.'
  23. for i, val in enumerate(letters):
  24. if val == letter:
  25. out = i
  26. break
  27. return out
  28.  
  29.  
  30. def multiply_letter(letter: str, times: int) -> str:
  31. """
  32. Multiplying letters
  33.  
  34. :param times: int
  35. :param letter: str
  36. :return: str
  37. """
  38. for x in letter:
  39. if letter == x:
  40. return x *times
  41.  
  42.  
  43. def decrypt_cipher(ciphertext: str, key: int) -> str:
  44. """
  45. Decrypt and you shall find.
  46.  
  47. :param ciphertext: str
  48. :param key: int
  49. :return:
  50. """
  51. return ''.join((ciphertext[i] for i in range(0, len(ciphertext),key)))
  52.  
  53.  
  54. def find_mode(string: str) -> str:
  55. """
  56. Find mode.
  57.  
  58. :param string: str
  59. :return: mode
  60. """
  61. return max(string, key=string.count) if string else ''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement