We’re starting off with all the English words and Pirate words in two separate lists where the positions of the lists correspond.  It is associated lists like this work but when a mapping solution is required, dictionaries are often a more natural implementation. (a) Your first job is to redesign the approach and turn these two lists into one dictionary. The words, both English and Pirate language, are distinct, so either one can be the key. Here are the original lists (feel free to add your own words; we got them by googling “Pirate Talk”) ENGLISH = ['hello', 'friend', 'hey', 'awful', 'wow','reward', 'song', 'money',            'board', 'cocktail', 'bathroom', 'friends', 'cheat', 'flag','boy',            'girl', 'my', 'take', 'sink', 'telescope', 'clean', 'you'] PIRATE = ['ahoy', 'matey', 'avast', 'bilge-sucking', 'blimey', 'booty', 'chanty',           'dubloon', 'plank', 'grogg', 'head', 'hearties', 'hornswaggle',           'jack', 'lad', 'lass', 'me', 'plunder', 'scuttle', 'spyglass', 'swob',           'ye'] (b) Now that you have your dictionary set up, prompt the user for a sentence, and then translate from English into Pirate. Allow the user to enter upper or lowercase letters but assume no punctuation. Use a while loop to keep prompting for a sentence to translate until the user enters ‘arr’

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Simple Dictionaries: Pirate-Talk Translator

We’ll use a Python dictionary as an actual dictionary. As we discussed in our lecture this week, a dictionary is really good for 1-1 mapping of concepts-to-values, so that's what we'll do here.

We’re starting off with all the English words and Pirate words in two separate lists where the positions of the lists correspond.  It is associated lists like this work but when a mapping solution is required, dictionaries are often a more natural implementation.

(a) Your first job is to redesign the approach and turn these two lists into one dictionary. The words, both English and Pirate language, are distinct, so either one can be the key.

Here are the original lists (feel free to add your own words; we got them by googling “Pirate Talk”)

ENGLISH = ['hello', 'friend', 'hey', 'awful', 'wow','reward', 'song', 'money',

           'board', 'cocktail', 'bathroom', 'friends', 'cheat', 'flag','boy',

           'girl', 'my', 'take', 'sink', 'telescope', 'clean', 'you']

PIRATE = ['ahoy', 'matey', 'avast', 'bilge-sucking', 'blimey', 'booty', 'chanty',

          'dubloon', 'plank', 'grogg', 'head', 'hearties', 'hornswaggle',

          'jack', 'lad', 'lass', 'me', 'plunder', 'scuttle', 'spyglass', 'swob',

          'ye']

(b) Now that you have your dictionary set up, prompt the user for a sentence, and then translate from English into Pirate. Allow the user to enter upper or lowercase letters but assume no punctuation. Use a while loop to keep prompting for a sentence to translate until the user enters ‘arr’.

Here's an example of running this one:
RESTART: /Users/keithbagley/Dropbox/NORTHEASTERN
Arrrrr welcome to me pirate dictionary!
Type some stuff, then hit enter with yer sword.
Or just say 'arr' to be done, ya scalliwag.
hello my friends
ahoy me hearties
Type some stuff, then hit enter with yer Sword.
Or just say 'arr' to be done, ya scalliwag.
Wow this cocktail is awful
blimey this grogg is bilge-sucking
Type some stuff, then hit enter with yer sword.
Or just say 'arr' to be done, ya scalliwag.
sing me a song while you clean the bathroom
sing me a chanty while ye swob the head
Type some stuff, then hit enter with yer sword.
Or just say 'arr' to be done, ya scalliwag.
arr
>>>
Transcribed Image Text:Here's an example of running this one: RESTART: /Users/keithbagley/Dropbox/NORTHEASTERN Arrrrr welcome to me pirate dictionary! Type some stuff, then hit enter with yer sword. Or just say 'arr' to be done, ya scalliwag. hello my friends ahoy me hearties Type some stuff, then hit enter with yer Sword. Or just say 'arr' to be done, ya scalliwag. Wow this cocktail is awful blimey this grogg is bilge-sucking Type some stuff, then hit enter with yer sword. Or just say 'arr' to be done, ya scalliwag. sing me a song while you clean the bathroom sing me a chanty while ye swob the head Type some stuff, then hit enter with yer sword. Or just say 'arr' to be done, ya scalliwag. arr >>>
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education