import decimal
import fractions
from boltons.iterutils import backoff

alcoholic = [
    {'group': 'Tagalog', 'percentage': '28.1%'},
    {'group': 'Cebuano', 'percentage': '13.1%'},
    {'group': 'Ilocano', 'percentage': '9.3%'},
    {'group': 'Bisaya', 'percentage': '7.6%'},
    {'group': 'Hiligaynon', 'percentage': '7.5%'},
    {'group': 'Bikol', 'percentage': '6.7%'},
    {'group': 'Waray', 'percentage': '3.4%'},
    {'group': 'Other', 'percentage': '25.3%'}
]

print(f'Ethnic Group         Percentage           Fraction')
for line in ethnic_groups:
   line_dec = decimal.Decimal(line['percentage'].split('%')[0])
   line_frac = fractions.Fraction(line_dec)
   e_group = line['group']

   print(f'{e_group:<20} {line_dec:<20} {line_frac}')
   