SHARE
TWEET

Untitled

a guest Apr 26th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = int(input())
  2. data = []
  3. for i in range(n):
  4.     d = input()
  5.     num, ves = d.split()
  6.     num = int(num)
  7.     mul = 1
  8.     # анализируем веса
  9.     if ves[-1] == 'g':
  10.         mul *= 1
  11.     elif ves[-1] == 't':
  12.         mul *= 10 ** 6
  13.     elif ves[-1] == 'p':
  14.         mul *= 16380
  15.     # анализируем приставки
  16.     if ves[0] == 'm':
  17.         mul *= 10 ** (-3)
  18.     elif ves[0] == 'k':
  19.         mul *= 10 ** 3
  20.     elif ves[0] == 'M':
  21.         mul *= 10 ** 6
  22.     elif ves[0] == 'G':
  23.         mul *= 10 ** 9
  24.     data.append((num * mul, d))
  25. for elem in sorted(data):
  26.     print(elem[1])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top