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, 21.06.2019 21:00
It is not a good idea in a cover letter to mention another person whom the employer knows.
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
question
Computers and Technology, 24.06.2019 12:00
What is a sketch or blueprint of a web page that shows the structure (but not the detailed design) of basic page elements such as the logo, navigation, content, and footer?
Answers: 3
question
Computers and Technology, 24.06.2019 23:00
Aselect query joins tables together by their a. table names. b. primary keys. c. first entries. d. field names.
Answers: 2
You know the right answer?
Write a python program that will translate words into "pirate speak." start by looking at the follow...
Questions
question
Mathematics, 13.07.2019 22:30
question
Mathematics, 13.07.2019 22:30
Questions on the website: 13722360