QuestionQuestion

Write a Hash Table class, based on the one in module 4.3, where the size of the Hash Table is set as 26, and there is a function called setHash that accepts a string of 26 unique characters and puts them into the hashtable. Then, in a function called translateHash, based on the order of the characters of the string and the order of the letters of the alphabet, the HashTable must be able to translate any string's letter-based characters into the respective characters of the HashTable.

(Hint: regular expressions may be useful.)
Example:
ht = Hash Table()
ht.setHash("zyxwvutsrqponmlkjihgfedcba")
translation =ht.translateHash("hello world") =
print(translation) should return svool dliow

Test Specifications
Spaces, punctuation, and all other special characters will be kept the same, only the letters of the alphabet will be converted.
The input alphabet string to setHash must not contain duplicate characters.
setHash will return True if a valid alphabet is given (26 characters, no duplicates).

Otherwise it will return False.
If translateHash is run before setHash, or an invalid alphabet was previously specified, have translateHash return False, else return the translated string.
Uppercase must become lowercase.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import unittest
import numpy as np
import re


def matrixMult(arr1, arr2):
    pass


class HashTable:
    def __in...
$20.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats