USE PYTHON ONLY USE DEF function For number 68 Solutionusrbi

USE PYTHON ONLY USE DEF function. For number 68

Solution

#!/usr/bin/python
import sys
#Global variables
interest =0
montlyPayment =0
balance =0
interestPaidForMonth =0
reducOfPrincipal =0
eomBalance =0

# getInput Function definition is here
def getInput():
   global interest, montlyPayment, balance;
   interest = input(\"Enter annual rate of interest:\")
   montlyPayment= input(\"\ Enter monthly payment:\")
   balance= input(\"\ Enter beg. of month balance:\")
   interest = float(interest)
   montlyPayment=float(montlyPayment)
   balance=float(balance)
   return;
  
# calculateOutput Function definition is here  
def calculateOutput():
   global interestPaidForMonth, reducOfPrincipal, eomBalance
   interestPaidForMonth= ((balance*interest)/100)/12
   reducOfPrincipal = montlyPayment-interestPaidForMonth
   eomBalance = balance-reducOfPrincipal
   return;

def showOutput():
   print(\"Interest paid For the month:\",round(interestPaidForMonth, 2))
   print(\"\ Reduction of principal:\",round(reducOfPrincipal, 2))
   print(\"\ End of month balance:\",round(eomBalance, 2))
  
  
def main():
  

   getInput()
   calculateOutput();
   showOutput()
  
main()

#In the question the value of reduction of principal is given wrong

#Using python , call by reference is not possible

USE PYTHON ONLY USE DEF function. For number 68 Solution#!/usr/bin/python import sys #Global variables interest =0 montlyPayment =0 balance =0 interestPaidForMo

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site