Question: A long, long time ago, before applications such as Google Translate or Reverso were installed on everyone s phones, people used thick books to translate
A long, long time ago, before applications such as Google Translate or Reverso were installed on everyones phones, people used thick books to translate words from English to another language. Can you believe that? These books would hold a list of English words and write their respective translations behind them. These miraculous books were called dictionaries. Coincidentally or not one of Pythons four builtin data structures is also called a dictionary. And, coincidentally or not this dictionary functions very similarly to these miraculous ancient books.
The Python dictionary is a commonly used and powerful data structure. It stores data values in socalled key:value pairs These pairs are ordered and can be changed throughout the data structures use. Duplicate keys are not allowed. The usage of a Python dictionary is very straightforward: you access it via a key and get the value corresponding with that key.
The possibilities of dictionaries are endless, but lets stay true to their name and use one as an actual dictionary to build a basic English to German Translator App. This Translator App should translate common phrases from English to German, to help us survive our next trip to Germany.
Create your script called translator.py and define a variable named englishtogerman, which you fill with the following dictionary:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
