python-101 icon indicating copy to clipboard operation
python-101 copied to clipboard

Fix currency input validation in 10_currency.py

Open Ishan-Karpe opened this issue 4 months ago • 0 comments

Summary

Fixed the currency converter to properly handle decimal values by changing int(input()) to float(input()) for all three currency inputs (pesos, soles, reais).

Problem

The original code used int(input()) which truncates decimal places, causing incorrect calculations when users input currency amounts with cents (e.g., 10.50 would become 10).

Solution

  • Changed all three int(input()) calls to float(input())
  • Tested with decimal values to ensure correct calculation
  • Verified the fix works properly with sample inputs

Test Results

Tested with inputs: 100.50 pesos, 200.75 soles, 150.25 reais Expected result: 87.787625 Actual result: 87.787625 ✅

Fixes #127

Ishan-Karpe avatar Aug 11 '25 18:08 Ishan-Karpe