Fabulous Feb Offer: Flat 70% Off + 20-days Extra Lab + 10% Addl. Off on All Courses | Use Coupon Code FAFB | Expires inEnroll Now
Let's try to solve a simple problem in Scala - Calculation of the simple interest.
We want to calculate what would be the simple interest for 5 years if the principal amount is 500 and the interest rate is 12% annually.
We will need to define 3 variables and perform the calculation to get the interest.
Open Jupyter notebook on the right-hand side tab.
Declare integer variables as described below.
principal - assign a value of 500
interest_rate - assign a value of 12
years - assign a value of 5
Now, declare a new variable
interest which will be assigned the value of calculation of interest like below:
interest = [calculation of simple interest using above defined variables]
Press Shift+Enter in each of the cells where you wrote the code.
Click on "Submit Answer".
Taking you to the next exercise in seconds...