1.Complete Steps 1-7 in the comments below. The remaining comments explain the logic. Customers can check a variety of loans and interest rates. When finished, type quit # Step 1: add an input statement to enter name or type quit to exit # Step 2: add a while loop to keep asking for a name until the user types quit # Step 3: declare two variables for loan and interest, like months below, # convert them to float, and ask the user to input their values to the screen. months = float(input("How many months will it take to repay your loan? ")) print("***************************************************************") print (name, "you requested an estimate on a loan for {0:.2f}" .format(loan)) # Step 4: add a print statement to display the interest and # of months print("*******************************************************************************") print("Here are the rates for simple interest, compound interest, and monthly interest", "\n") # calculate the rate for one month's interest + payment by adding 1 to a month's interest interest_rate = float((interest/12)+1) # calculate the compound interest per payment period by raising the # monthly payment to the negative power of total months compound_interest = float(1-((interest/12)+1) ** -months) # Step 5: print the interest_rate and compound_interest to the display screen # calculate the monthly interest based on the compound interest monthly_interest = float((interest/12)/ compound_interest) print(monthly_interest, "\n") # calculate the monthly loan payment with monthly compound interest payments = float(loan * monthly_interest) # Step 6: write a print statement that displays the monthly payments to two decimal points # Tip: use the 0:.2f format from an earlier example, only for the payments print("*******************************************") # Step 7: add an input statement to enter name or type quit to exit print() print("Thank you for using the Mortgage Loan Calculator")
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
1.Complete Steps 1-7 in the comments below. The remaining comments explain the logic.
Customers can check a variety of loans and interest rates. When finished, type quit
# Step 1: add an input statement to enter name or type quit to exit
# Step 2: add a while loop to keep asking for a name until the user types quit
# Step 3: declare two variables for loan and interest, like months below,
# convert them to float, and ask the user to input their values to the screen.
months = float(input("How many months will it take to repay your loan? "))
print("***************************************************************")
print (name, "you requested an estimate on a loan for {0:.2f}" .format(loan))
# Step 4: add a print statement to display the interest and # of months
print("*******************************************************************************")
print("Here are the rates for simple interest, compound interest, and monthly interest", "\n")
# calculate the rate for one month's interest + payment by adding 1 to a month's interest
interest_rate = float((interest/12)+1)
# calculate the compound interest per payment period by raising the
# monthly payment to the negative power of total months
compound_interest = float(1-((interest/12)+1) ** -months)
# Step 5: print the interest_rate and compound_interest to the display screen
# calculate the monthly interest based on the compound interest
monthly_interest = float((interest/12)/ compound_interest)
print(monthly_interest, "\n")
# calculate the monthly loan payment with monthly compound interest
payments = float(loan * monthly_interest)
# Step 6: write a print statement that displays the monthly payments to two decimal points
# Tip: use the 0:.2f format from an earlier example, only for the payments
print("*******************************************")
# Step 7: add an input statement to enter name or type quit to exit
print()
print("Thank you for using the Mortgage Loan Calculator")
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images