python-mastery/pcost.py
2023-08-09 16:59:22 -05:00

18 lines
415 B
Python

from decimal import Decimal
def run(filename: str) -> Decimal:
with open(filename, 'r') as lines:
total = Decimal(0.0)
_, count, price = lines.readline().split()
count = Decimal(count)
price = Decimal(price)
total += count * price
return total
if __name__ == '__main__':
filename = 'Data/portfolio.dat'
value = run(filename)
print(f"value = {value}")