Dictionary problems
| categories: Practice
Try programming these before class on Wednesday.
Suppose you have a file like this one except with many more lines. Each line has a alphanumeric code in the first 10 columns and lots of other data after that. You mission is to create a new file containing only the first line with each code. Think of the lines with same code as accidental duplicates that you are trying to remove. Don't change the format of the file in any way, simply omit the lines that duplicate a previous code.
Suppose you trying to make texts more readable to old folks by replacing common acronyms with the phrase they represent. Your acronyms might be represented in a dictionary like this:
tla = {
'abt': 'about',
'adn': 'any day now',
'irl': 'in real life',
'lol': 'laugh out loud',
'b4': 'before'
}
For a text message like 'hello abt to lol' you should produce the output 'hello about to laugh out loud'