gpt-4o-mini-2024-07-18· OpenAI
WildChat-4.8M (AI2)
gibemeinfyieldscript
- User
gibemeinfyieldscript
- Assistant
It seems like you might be looking for a script to calculate the yield on investments or a specific type of asset. Below is a simple Python script that calculates the yield based on the investment amount, annual income from the investment, and the investment duration. You can modify it as needed.
Python Script to Calculate Investment Yield
def calculate_yield(investment_amount, annual_income, years): # Calculate total income over the investment period total_income = annual_income * years # Total return on investment is the initial investment plus total income earned total_return = investment_amount + total_income # Yield is calculated as (Total return - Investment) / Investment investment_yield = (total_return - investment_amount) / investment_amount * 100 return investment_yield, total_income, total_return def main(): # Get user input investment_amount = float(input("Enter the initial investment amount: ")) annual_income = float(input("Enter the annual income from the investment: ")) years = int(input("Enter the number of years of the investment: ")) # Calculate yield investment_yield, total_income, total_return = calculate_yield(investment_amount, annual_income, years) # Display the results print(f"\nTotal income from the investment over {years} years: ${total_income:.2f}") print(f"Total return on investment after {years} years: ${total_return:.2f}") print(f"Investment yield: {investment_yield:.2f}%") if __name__ == "__main__": main()
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.