{"id":8260,"date":"2021-09-30T11:00:36","date_gmt":"2021-09-30T05:30:36","guid":{"rendered":"https:\/\/python-programs.com\/?p=8260"},"modified":"2021-11-22T18:35:31","modified_gmt":"2021-11-22T13:05:31","slug":"python-program-to-compute-simple-interest","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-compute-simple-interest\/","title":{"rendered":"Python Program to Compute Simple Interest"},"content":{"rendered":"
Have you mastered basic programming topics of java and looking forward to mastering advanced topics in a java programming language? Go with these ultimate Advanced java programs examples with output<\/a> & achieve your goal in improving java coding skills.<\/p>\n Simple Interest:<\/strong><\/p>\n Simple interest (S.I) is the way by which the interest amount is calculated for a capital amount. If your pocket money is exhausted, did you ever borrow your siblings? Or perhaps lent him? When you borrow money, what happens? You utilize this money first and foremost for the purpose you borrowed. Afterwards, when you get your parents’ pocket money the next month, you give the money back. That’s how to borrow and lend at home.<\/p>\n But in the real world, money is not free to borrow. You typically have to borrow money from banks in the form of a loan. You paid a certain amount of money during paybacks, apart from the amount of the loan, depending both on the lending amount and on the lending time. Simple interest is called this. This word is often used in the banking industry.<\/p>\n Given all the required values like amount ,rate and time the task is to calculate the simple interest for the given values in Python<\/p>\n Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n We can calculate simple interest easily using python:<\/p>\n Drive into Python Programming Examples<\/a> and explore more instances related to python concepts so that you can become proficient in generating programs in Python Programming Language.<\/p>\n Formula for simple interest is given by:<\/p>\n SimpleInterest = (P x T x R) \/ 100<\/p>\n where<\/p>\n P= Principal Amount(given amount in this case)<\/p>\n T = Time Period (given time in this case)<\/p>\n R = Rate of interest( given rate in this case)<\/p><\/blockquote>\n The primary complexity is the user’s input, since the values can be either decimal (float) or integer.<\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Explanation:<\/strong><\/p>\n Approach:<\/strong><\/p>\n The application will request that the user first enter all three values. The input values of the user are floating. We can also utilize entities, although integer types are unlikely to always hold the main amount, time and interest. Then the simple interest will be calculated using the above formula and the result is printed.<\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Explanation:<\/strong><\/p>\n Take the user input for the amount, time and rate of interest for calculation of the simple interest in years. We read<\/p>\n the data with the input() method and then use float() to convert it to a floating point number. The method input()<\/p>\n reads the input of the user as a string. Therefore, initially we must convert it to float.<\/p>\n For calculating a simple interest, the formula (amount*time*rate):\/100 is used.<\/p>\n Related Programs<\/strong>:<\/p>\n Have you mastered basic programming topics of java and looking forward to mastering advanced topics in a java programming language? Go with these ultimate Advanced java programs examples with output & achieve your goal in improving java coding skills. Simple Interest: Simple interest (S.I) is the way by which the interest amount is calculated for …<\/p>\ngiven amount=18816\r\n\r\ngiven time= 3\r\n\r\ngiven rate= 8.43<\/pre>\n
given amount=49332\r\n\r\ngiven time=3.4\r\n\r\ngiven rate=6.732<\/pre>\n
The simple interest for the amount 49332 in 3.4 at the rate 6.732 % = 11291.502815999998<\/pre>\n
Program to Compute Simple Interest in Python<\/h2>\n
\n
Method #1: Calculating Simple interest \u00a0(Static Input)<\/h3>\n
\n
# given amount\r\ngiven_amount = 18816\r\n# given time in years\r\ngiven_time = 3\r\n# given rate of interest\r\ngiven_rate = 8.43\r\n# calculating simpleInterest using formula\r\nsimpleInt = (given_amount*given_time*given_rate)\/100\r\n# printing the simpleInterest of the above values\r\nprint(\"The simple interest for the amount\", given_amount, \"in\",\r\n given_time, \"at the rate\", given_rate, \"% =\", simpleInt)\r\n<\/pre>\n
The simple interest for the amount 18816 in 3 at the rate 8.43 % = 4758.5664<\/pre>\n
\n
Method #2: Calculating Simple interest (User Input)<\/h3>\n
# given amount\r\ngiven_amount = float(input(\"Enter the amount of which you want to calculate simple interest =\"))\r\n# given time in years\r\ngiven_time=float(input(\"Enter the time of which you want to calculate simple interest = \"))\r\n# given rate of interest\r\ngiven_rate=float(input(\"Enter the rate of interest of which you want to calculate simple interest = \"))\r\n# calculating simpleInterest using formula\r\nsimpleInt=(given_amount*given_time*given_rate)\/100\r\n# printing the simpleInterest of the above values\r\nprint(\"The simple interest for the amount\", given_amount, \"in\",\r\n given_time, \"at the rate\", given_rate, \"% =\", simpleInt)\r\n<\/pre>\n
Enter the amount of which you want to calculate simple interest =39929\r\nEnter the time of which you want to calculate simple interest = 7.5\r\nEnter the rate of interest of which you want to calculate simple interest = 3.24\r\nThe simple interest for the amount 399299.0 in 7.5 at the rate 3.24 % = 97029.657<\/pre>\n
\n