# E-2 MCS 260 Fri 11 July 2014 : first question on second part of midterm
"""
To measure large quantities in computer science, we use Kilo (K),
Mega (M), Giga~(G), and Tera (T) to abbreviate respectively
2^{10}, 2^{20}, 2^{30}, and 2^{40}
   
llustrate how to encode this information in Python in a dictionary,
with keys K, M, G, and T.

Using your dictionary, show how a string such as
s = '200 MB' is converted into '209715200 B'.
You may assume that the number in the string s is integer
and separated by exactly one space from the letter K, M, G, or T.

Instead of 'B' in the example for s, we could have any sequence
of characters, such as bytes or Hz.
"""
D = {'K':2**10, 'M':2**20, 'G':2**30, 'T':2**40}
s = '200 Mbytes'
L = s.split()
r = int(L[0])* D[L[1][0]]
t = str(r) + ' ' + L[1][1:]
print t
