Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from operator import itemgetter
- import sys
- total_lang = {}
- total_lang['en'] = 0.0
- total_lang['pl'] = 0.0
- total_lang['hu'] = 0.0
- total_lang['de'] = 0.0
- total_lang['sv'] = 0.0
- total_lang['nl'] = 0.0
- #print word + "\t" + en + "\t" + pl + "\t" + hu + "\t" + de + "\t" + sv + "\t" + nl
- for line in sys.stdin:
- line = line.strip()
- word, en, pl, hu, de, sv, nl = line.split('\t')
- # try:
- total_lang['en'] += float(en)
- total_lang['pl'] += float(pl)
- total_lang['hu'] += float(hu)
- total_lang['de'] += float(de)
- total_lang['sv'] += float(sv)
- total_lang['nl'] += float(nl)
- # except ValueError:
- # pass
- print "Total points: "+ " en:" + str(total_lang['en']) + " pl:" + str(total_lang['pl']) + " hu:" + str(total_lang['hu']) + " de:" + str(total_lang['de']) + " sv:" + str(total_lang['sv']) + " nl:" + str(total_lang['nl'])
- print "Language probably is: " + max(total_lang.iteritems(), key=itemgetter(1))[0]
Add Comment
Please, Sign In to add comment