Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
string manipulation
#5
(Apr-09-2018, 10:58 PM)scidam Wrote: Your task is quite sophisticated ... Lets consider your translation table
my_dict = { 'He':'x', 'l':'y', 'd':'n', 'o ':'g', ' fri':'t', 'nd!': 'q', 'e':'T'}
It is an unordered set of keys and values (dicts are unordered structures in Python), so performing translation of the word "Hello" we need to decide how to translate e.g. the "He" term,
Quote:He -> x
or
Quote:He -> HT
Since the translation table (my_dict) is an unordered structure, it is impossible to solve which variant of translation is right...

It would have to make He -> x not HT. Which is why its difficult
Reply


Messages In This Thread
string manipulation - by yogi123 - Apr-08-2018, 09:28 PM
RE: string manipulation - by scidam - Apr-09-2018, 01:29 AM
RE: string manipulation - by yogi123 - Apr-09-2018, 02:24 AM
RE: string manipulation - by scidam - Apr-09-2018, 10:58 PM
RE: string manipulation - by yogi123 - Apr-10-2018, 02:42 PM
RE: string manipulation - by scidam - Apr-12-2018, 04:08 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020