Question

Please I wish you use Python 3.7 for this problems. Q1. Write a program that receives...

Please I wish you use Python 3.7 for this problems.

Q1. Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he or she is finished providing inputs. After the user presses the enter key, the program should print the sum of the numbers and their average.

Q2. The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of 12%. Monthly payments are 5% of the listed purchase price, minus the down payment. Write a program that takes the purchase price as input. The program should display a table, with appropriate headers, of a payment schedule for the lifetime of the loan. Each row of the table should contain the following items:

- the month number (beginning with 1)

- the current total balance owed

- the interest owed for that month

- the amount of principal owed for that month

- the payment for that month

- the balance remaining after payment

The amount of interest for a month is equal to balance * rate / 12. The amount of principal for a month is equal to the monthly payment minus the interest owed.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

SOLUTION Q1:

NOTE: Explanation is done in the comments itself, you can do it by using inbuilt function sum, len

CODE WITHOUT USING INBUILT FUNCTION:


##read the data of input into the list by doing split so

data=input("enter the numbers by giving space when you finished entering pess 'Enter' button").split(" ")

count=0
sumOfData=0
##take data from list and add to get sum and increase count

for i in data:
if(i!=''):
##i have written this condition for only one case when you enter space at the end the lsit will contain an empty element at the end when we do split
##to overcome that i have written this condition
count=count+1
sumOfData=sumOfData+int(i)
  

## sum is used to calsulate sum of list elements
print("Sum is ",sumOfData)

##average is sum of all terms by number of terms len will give length of list means number of elements

print("Average is ",sumOfData/count)

CODE WITH USING INBUILT FUNCTIONS:

##read the data of input into the list dont enter space at the end if you give space it will through error like an '' not an int since if you space split will take a new empty string

data=list(map(int,input("enter the numbers by giving space when you finished entering pess 'Enter' button").split(" ")))

## sum is used to calsulate sum of list elements
print("Sum is ",sum(data))

##average is sum of all terms by number of terms len will give length of

print("Average is ",sum(data)/len(data))

IMAGE-> CODE WITHOUT USING INBUILT FUNCTION::

IMAGE->CODE WITH USING INBUILT FUNCTIONS:

OUTPUT:

SOLUTION Q2:

NOTE: Explanation is done in the code itself.


##intialize the rate of intrest
rate=12

##read the principal
principal=float(input("Enter the principal Amount : "))

##10 % down payment
print("Down payment is ",principal/10)

##substract the down payment so that the remaining amount is paid in installments
balance=principal-(principal/10)

## we need to apply 12% intrest on the amount
monthPayment=balance *0.05

##intialize month as zero
month=1;
print(": Month : current Balance : interest Owed : Amount owed for the month : payment for the month : Balance Remaining")

##Execute till all the amount is paid
while(balance>0):
##intrest calculation is based on the balance intrest formulae for month is (p*time*rate)/100*12 in the it was given without 100 so i corrected it and written it if that is wrong remove that
##100 and execute the code, I tink that it should have 100 in the formulae
interest=round((balance*rate)/(100*12),2)
##amount to be paid for the month including intrest
monthAmount=round(interest+monthPayment,2)


##here i have printed data in the table format consodering the heading, here the numbers 4,14,12,24,20 are the length of the headings like "Month","current Balance "like these heading
##you can give this by len("month") , Here i have considered the size of the heading and then substracted the len of the printed data and replaced the remaining with " "(space)
##In a simple way i have printed the spaces for making the table order correctly
  
print(":",month," "*(4-len(str(month))),":",balance, " "*(14-len(str(balance))),":",
interest," "*(12-len(str(interest))),":",monthPayment," "*(24-len(str(monthPayment))),":",monthAmount," "*(20- len(str(monthAmount))),":",balance-monthPayment)

##increase the month number
month=month+1
##reduce the balance after payment
balance=balance-monthPayment

IMAGE CODE:


  
  

OUTPUT:

Add a comment
Know the answer?
Add Answer to:
Please I wish you use Python 3.7 for this problems. Q1. Write a program that receives...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please answer in Python with indentation, ty. The credit plan at TidBit Computer Store specifies a...

    Please answer in Python with indentation, ty. The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of 12%. Monthly payments are 5% of the listed purchase price, minus the down payment. Write a program that takes the purchase price as input. The program should display a table, with appropriate headers, of a payment schedule for the lifetime of the loan. Each row of the table should contain the following items: The month...

  • PYTHON CODE PLEASE!!! The credit plan at TidBit Computer Store specifies a 10% down payment and...

    PYTHON CODE PLEASE!!! The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of 12%. Monthly payments are 5% of the listed purchase price, minus the down payment. Write a program that takes the purchase price as input. The program should display a table, with appropriate headers, of a payment schedule for the lifetime of the loan. Each row of the table should contain the following items: The month number (beginning with 1)...

  • i need this to be in OOP using C++ 25. Savings Account Balance Write a program...

    i need this to be in OOP using C++ 25. Savings Account Balance Write a program that calculates the balance of a savings account at the end of a three-month feried. It should ask the user for the starting balance and the annual interest rate. A loop abculd then iterate once for every month in the period, performing the following steps: B) A) Ask the user for the total amount deposited into the account during that month and add it...

  • -----------Python program------------------- Instructions: For this assignment, you will write complete a program that allows a customer...

    -----------Python program------------------- Instructions: For this assignment, you will write complete a program that allows a customer to plan for retirement. Part 2: Generate a Retirement Planning Table: It's hard to decide how much you need to save for retirement. To help your customer visualize how long her nest egg will last, write a program that allows the user to generate a retirement planning table showing the number of months the savings will last for various combinations of starting account balance...

  • This C++ Program should be written in visual studio 2017 You are to write a program...

    This C++ Program should be written in visual studio 2017 You are to write a program that can do two things: it will help users see how long it will take to achieve a certain investment goal given an annual investment amount and an annual rate of return; also, it will help them see how long it will take to pay off a loan given a principal amount, an annual payment amount and an annual interest rate. When the user...

  • Write a python program for the below question? Car Loan If A dollars is borrowed at...

    Write a python program for the below question? Car Loan If A dollars is borrowed at r% interest compounded monthly to purchase a car with monthly payments for n years, then the monthly payment is given by the formula monthly payment = i / 1 - (1 + i)-12n . A where i = r/1200. Write a program that calculates the monthly payment after the user gives the amount of the loan, the interest rate, and the number of years.

  • C++ 18. Savings Account Balance Write a program that calculates the balance of a savings account...

    C++ 18. Savings Account Balance Write a program that calculates the balance of a savings account at the end of a three month period. It should ask the user for the starting balance and the annual interest rate. A loop should then iterate once for every month in the period, performing the following A) Ask the user for the total amount deposited into the account during that month. Do not accept negative numbers. This amount should be added to the...

  • using Matlab program: Create a loan payment program that can be used for any loan amount...

    using Matlab program: Create a loan payment program that can be used for any loan amount such as a home or car loan. The program should ask the user for the input values below, compute the monthly payment, then compute the monthly balance. Display the balance in a table Month             Balance 1                      $ ##.## 2                      $ ##.## 3                      $ ##.##       . . . etc Use the formula PMT=P*(r(1+r)^n)/((1+r)^n-1) PMT = the monthly payment. P = the principal r = the interest rate per month, which...

  • c++ and please add tables and everything and make sure program is complete. Write a menu...

    c++ and please add tables and everything and make sure program is complete. Write a menu driven program, which would compute compound interest and a monthly payment for a loan. The user will be given a choice to display the info on the screen or to a filo Menu will be the following Enter (1) to calculate your loan monthly payment Enter (2) to calculate your loan monthly payment & write to a file Tips: Compound Interest Formula A =...

  • Write a program in Python that computes the interest accrued on an account. You can modify...

    Write a program in Python that computes the interest accrued on an account. You can modify the “futval.py” program given in Chapter 2 to accomplish it. Your program should use a counted loop rather than a formula. It should prompt the user to enter the principal amount, the yearly interest rate as a decimal number, the number of compounding periods in a year, and the duration. It should display the principal value at the end of the duration. To compute...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT