From c4268ddf9bcac0f69b838699074f6eea71ae7cc2 Mon Sep 17 00:00:00 2001 From: shriranga Date: Tue, 6 Aug 2024 17:13:33 +0530 Subject: [PATCH 1/3] Created Investment Rules folder and added a snippet to calulate time take to double your investments --- INVESTMENT_RULES/README.md | 13 +++++++++++++ INVESTMENT_RULES/rule_of_72.py | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100644 INVESTMENT_RULES/README.md create mode 100644 INVESTMENT_RULES/rule_of_72.py diff --git a/INVESTMENT_RULES/README.md b/INVESTMENT_RULES/README.md new file mode 100644 index 00000000..0a85c11d --- /dev/null +++ b/INVESTMENT_RULES/README.md @@ -0,0 +1,13 @@ +## What Is the Rule of 72? + The Rule of 72 is a simple way to determine how long an investment will take to double given a fixed annual rate of interest. Dividing 72 by the annual rate of return gives investors a rough estimate of how many years it will take for the initial investment to duplicate itself. + +### Key takeaways + The Rule of 72 is not precise, but is a quick way to get a useful ballpark figure. + For investments without a fixed rate of return, you can instead divide 72 by the number of years you hope it will take to double your money. This will give you an estimate of the annual rate of return you’ll need to achieve that goal. + The calculation is most accurate for rates of return of about 5% to 10%. + For more precise outcomes, divide 69.3 by the rate of return. While not as easy to do in one’s head, it is more accurate. + +### How the Rule of 72 Works + For example, the Rule of 72 states that $1 invested at an annual fixed interest rate of 10% would take 7.2 years ((72 ÷ 10) = 7.2) to grow to $2. + +For more details refer https://www.investopedia.com/ask/answers/what-is-the-rule-72/ \ No newline at end of file diff --git a/INVESTMENT_RULES/rule_of_72.py b/INVESTMENT_RULES/rule_of_72.py new file mode 100644 index 00000000..82e3d58b --- /dev/null +++ b/INVESTMENT_RULES/rule_of_72.py @@ -0,0 +1,11 @@ +# Get Aannual fixed interest rate +fixed_interest_rate = input("Please enter the Annual Fixed interest rate (don't use % sign): ") + + +def calculate_time_taken_to_double(fixed_interest_rate): + # It will get the time zone of the user location + time_taken = 72/float(fixed_interest_rate) + return time_taken + +time_taken_to_double = round(calculate_time_taken_to_double(fixed_interest_rate),2) +print(f"Your investment will take {time_taken_to_double} year(s) to double") \ No newline at end of file From 2f86e47a5d1db8b97fa59aae649d865c1bbf4023 Mon Sep 17 00:00:00 2001 From: Mallikarjun Somanakatti Date: Tue, 6 Aug 2024 17:44:29 +0530 Subject: [PATCH 2/3] Update README.md Added a Title --- INVESTMENT_RULES/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/INVESTMENT_RULES/README.md b/INVESTMENT_RULES/README.md index 0a85c11d..12531ea0 100644 --- a/INVESTMENT_RULES/README.md +++ b/INVESTMENT_RULES/README.md @@ -1,3 +1,5 @@ +# List of python scripts that auomates calculation of some really handful of Investment Rules. + ## What Is the Rule of 72? The Rule of 72 is a simple way to determine how long an investment will take to double given a fixed annual rate of interest. Dividing 72 by the annual rate of return gives investors a rough estimate of how many years it will take for the initial investment to duplicate itself. @@ -10,4 +12,4 @@ ### How the Rule of 72 Works For example, the Rule of 72 states that $1 invested at an annual fixed interest rate of 10% would take 7.2 years ((72 ÷ 10) = 7.2) to grow to $2. -For more details refer https://www.investopedia.com/ask/answers/what-is-the-rule-72/ \ No newline at end of file +For more details refer https://www.investopedia.com/ask/answers/what-is-the-rule-72/ From bc154cea60d70dcadb985a99160a4a776681863f Mon Sep 17 00:00:00 2001 From: Mallikarjun Somanakatti Date: Tue, 6 Aug 2024 17:45:20 +0530 Subject: [PATCH 3/3] Updated comments Added useful comments and print function. --- INVESTMENT_RULES/rule_of_72.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/INVESTMENT_RULES/rule_of_72.py b/INVESTMENT_RULES/rule_of_72.py index 82e3d58b..8eafff84 100644 --- a/INVESTMENT_RULES/rule_of_72.py +++ b/INVESTMENT_RULES/rule_of_72.py @@ -3,9 +3,9 @@ def calculate_time_taken_to_double(fixed_interest_rate): - # It will get the time zone of the user location + # A simple formula calulate the time it takes to double an investment. time_taken = 72/float(fixed_interest_rate) return time_taken time_taken_to_double = round(calculate_time_taken_to_double(fixed_interest_rate),2) -print(f"Your investment will take {time_taken_to_double} year(s) to double") \ No newline at end of file +print(f"Your investment will take {time_taken_to_double} year(s) to double!")