CPSC120 Lab 9

Dictionaries

  1. TXT MSG

    Your grandmother hates it when you send text messages that she can’t read because of all the abbreviations. Create a program for your grandmother called txt_msg.py that prompts for the text of a message and prints the message in plain English by replacing all of the abbreviations. Assume that there is no punctuation in the message and that all words are separated with a space character. Do not use the string replace function. The program should use a dictionary that contains the following abbreviations:

    TXT MSG U LUV UR GR8 2MORO 2DAY 2NITE CU B4 THNQ
    text message you love you are great tomorrow today tonight see you before thank you
  2. Hexadecimal

    Create a program in a file called hexadecimal.py that prompts the user to enter a hexadecimal number and then prints the equivalent decimal value. A hexadecimal number is a base 16 number. The places for the values 0 - 9 are the same as decimal, but the places for the values 10 - 15 are the letters A - F. For example, the hexadecimal number 3A is equivalent to the decimal number 58. The program should use a dictionary to convert characters into their corresponding numbers.

  3. More Fuel Economy

    Create a program in a file called more_mileage_stats.py that prompts the user to enter a string that consists of a comma separated list of EPA vehicle information. The program should print the manufacturers with the highest average fuel economy. Assume that there is only one manufacturer with the highest fuel economy. The file epa_2013_data.txt is an example of what input to the program should look like.

Submission

Submit a zip file of your code on the course Inquire site that uses your last names as the file name.