message_cipher.conversions module
Conversions module.
This module defines functions for converting between characters and integers.
- message_cipher.conversions.char_to_int(char: str) int
Convert a single character to its numerical value.
- Parameters:
char (str) – A string of length 1 containing a letter.
- Returns:
An integer representation of
char.- Raises:
TypeError – If
charis not a single character (string of length 1).ValueError – If
charis not an english letter.
- Return type:
int
- message_cipher.conversions.int_to_char(number: int) str
Convert an integer to its corresponding character.
- Parameters:
number (int) – An integer to convert.
- Returns:
A string of length 1 containing letter representation of
number.- Raises:
ValueError – If
numberis not within the bounds [0, 26).- Return type:
str