subject

Write a python program that will translate words into "pirate speak." start by looking at the following file: translation. txt you will see that the file contains a series of translations from boring old english into pirate speak. the english string is separated from the pirate string by a colon, and each pair appears on a separate line. using this information, your program should ask the user to enter a line, and then it should translate the line into pirate speak. part of the translation involves randomly adding "are" to the end of some sentences. this should continue until the user enters "quit". the following is a sample interaction: art! welcome to the pirate translator! enter a line excuse me miss where is the restroom are comely wench what be the' head enter a line pardon me stranger but the officer is in the pub vast scurvy dog but the' foul braggart be in the' skull & scuppers, arr. enter a line: this is crazy this be crazy, arr. enter a line : quit follow these steps to create the translator program. be sure to use methods and comment as you write the code! test each part as you go. start by parsing the lines of the file into a dictionary structure. each line should be read in and split based on the colon character. before adding the phrases to the dictionary, be sure to remove the new line character from the end using the strip() command. create a loop that asks the user for a string until they enter "quit". in the string, replace each key in the dictionary with its pirate equivalent. add ", arr." to the end of the line with 30% probability. print the line. there is a subtle bug in the algorithm. when replacing a string with another, all instances of that string are replaced, even if it is in the middle of a word. for example, "is" gets replaced with "be", but "this is crazy" should not be translated into "the be crazy". fix this bug in the program.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 23:30
What can you prevent issues related to downloading content form the internet
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
Each time you save a document, you will need to type in the file type in which it should be saved you can select the save button to save it with the same file name if it has been previously saved you will need to select the location to save the file you will need to use the save as dialog box
Answers: 1
question
Computers and Technology, 24.06.2019 21:40
is on drugs i swear i ask a question and its not showing whats going
Answers: 2
question
Computers and Technology, 24.06.2019 21:40
Which of these is not a type of socket? aga (alternating grid array) pga (pin grid array) spga (staggered pin grid array) lga (land grid array)
Answers: 1
You know the right answer?
Write a python program that will translate words into "pirate speak." start by looking at the follow...
Questions
question
Physics, 16.12.2021 06:20
question
Mathematics, 16.12.2021 06:20
question
Biology, 16.12.2021 06:20
question
Mathematics, 16.12.2021 06:20
Questions on the website: 13722361