Untitled
unknown
plain_text
12 days ago
756 B
5
Indexable
Never
def process_curr(amount,curr): if curr in ["EUR","USD","SGD","BRL"]: return "{:.2f}".format(amount / 100) else: return "{:.2f}".format(amount / 1) def func(rows): ans=[] curr_card="" curr_dict="" for row in rows: if "_" in row: curr_card=row.split('_')[0] continue if "transaction" in row: curr_dict = row continue info=dict(zip(curr_dict.split(','), row.split(','))) ans_str=[curr_card+str(info["transaction"]),str(info["merchant"]),process_curr(info["amount"],info["currency"])+info[2],info["evidence_due_by"]] ans.append((info["transaction"],ans_str)) ans=sorted(ans) ans=[i[1] for i in ans] return "\n".join(ans)
Leave a Comment