Project Work
Develop a money exchange system in Python and write a report on it. Your project should include functionalities for converting between various currencies using exchange rates.
Steps to Follow:
Understand the Requirements:
1. Research and decide on the features to include, such as currency conversion, displaying exchange rates, and handling errors.
2. Identify the currencies to support (e.g., USD, EUR, GBP, INR, NPR).
Design the Program:
1. Outline the structure of your program using pseudocode or a flowchart.
2. Include functions for key features like fetching exchange rates, converting currencies, and displaying results.
Write the code
1. Develop the program in Python, ensuring proper use of functions, loops, and conditionals.
2. Organize the code into logical sections with meaningful variable and function names.
3. Add comments for clarity.
Test the Program:
1. Provide sample inputs and validate the outputs.
2. Ensure the program handles errors as well
Document the Analysis:
1. Describe whether the program executed without errors.
2. Provide examples of inputs and outputs to demonstrate functionality.
3. Assess whether the code is well-organized and easy to follow, noting any areas for improvement.
Suggest Improvements:
1. Propose additional features, such as live rate updates, historical rate tracking, or a graphical user interface.
2. Offer suggestions on how your peer could enhance the program’s functionality or code readability.
# Currency Exchange System (Simple version without functions)
# Dictionary of exchange rates (static example)
exchange_rates = {
"USD": {"EUR": 0.85, "GBP": 0.75, "INR": 74.5, "NPR": 120.5},
"EUR": {"USD": 1.18, "GBP": 0.88, "INR": 87.5, "NPR": 141.5},
"GBP": {"USD": 1.33, "EUR": 1.14, "INR": 100.5, "NPR": 160.5},
"INR": {"USD": 0.013, "EUR": 0.011, "GBP": 0.0099, "NPR": 1.61},
"NPR": {"USD": 0.0083, "EUR": 0.0071, "GBP": 0.0062, "INR": 0.62}
}
# Main Program Loop
while True:
print("\nWelcome to the Money Exchange System")
print("1. Convert Currency")
print("2. Display Exchange Rates")
print("3. Exit")
choice = input("Enter your choice (1/2/3): ")
if choice == '1':
# Currency Conversion
from_currency = input("Enter the source currency (USD, EUR, GBP, INR, NPR): ").upper()
to_currency = input("Enter the target currency (USD, EUR, GBP, INR, NPR): ").upper()
# Check if the currencies are valid
if from_currency in exchange_rates and to_currency in exchange_rates[from_currency]:
amount = float(input(f"Enter the amount in {from_currency}: "))
rate = exchange_rates[from_currency][to_currency]
converted_amount = amount * rate
print(f"{amount} {from_currency} = {converted_amount:.2f} {to_currency}")
else:
print("Error: Invalid currencies or conversion rate not available.")
elif choice == '2':
# Display Exchange Rates
print("Exchange Rates:")
for from_currency in exchange_rates:
for to_currency in exchange_rates[from_currency]:
print(f"1 {from_currency} = {exchange_rates[from_currency][to_currency]} {to_currency}")
elif choice == '3':
# Exit the program
print("Thank you for using the Money Exchange System. Goodbye!")
break
else:
# Invalid option
print("Invalid choice. Please enter a valid option.")
No comments:
Post a Comment