For part 1, you will NOT be writing anything in Python. You will be describing how the program will work using words and illustrations if it helps.
Using a dictionary, make a text encrypter/decrypter.
In decrypt mode, if the user inputs “Y r u l8?”, the program should output “Why are you late?”, for example.
In encrypt mode, if the user inputs “See you later”, it should output “c u l8r”.
Obviously you can’t handle every possible phrase, but add as many as you can. Don’t bother with multiword shortcuts for now (LOL, BRB, etc.)
How would this work?
What do you need to do?
Make a written outline of how you would accomplish the task using english or flow diagrams. Do NOT use any Python instructions in your description.
The projects has two parts one is database designing and the flow.
Instructions for the same .
1. Create a data base with these fields
ID | Autoincrement | primary key |
word | varchar | unique |
encryptedWord | varchar |
Second part.
1. writing a program
a. initialize a string variable.
b. prompt user for input.
c. as user hits enter, trim the input string and check the length of the string
if it is greater than 0 proceed
i. Now copy the string inot one more variable and string search(phase search) in a loop from data base such as we have stored {"id": 1, "word": "Lot's of laugh", "encrypt": "LOL"}
select * form tbl_encrypt_master
loop thrugh it.
if string matches with the word in the database
push it into another array(key as the phase and value as encripted value) and replace the matched with ""(empty string) now we have a smaller scentence,
exit
ii. Now the remainig string which did not matched with any of the string break the string with spaces and put the same into an array.
write a query for each of the word such as
select encrypt from tbl_encrypt_master where word="'+newStringVal[index]+'"
if result of it greater than zero store it into the key value array same as phase.
else also store the same into the array with empty string.
iii. now use the older string and the array where you can use find and replace of the string and phase.
else prompt for input
Get Answers For Free
Most questions answered within 1 hours.