From 1ddf82b2ad35dc035189900c6208296c03e16f97 Mon Sep 17 00:00:00 2001 From: rakesh Date: Tue, 24 Dec 2019 11:30:34 +0530 Subject: [PATCH] list programs --- Loops/tempCodeRunnerFile.py | 21 ++++++++++++++++++++- list/shifting_number.py | 15 +++++++++++++++ list/tempCodeRunnerFile.py | 1 + 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 list/shifting_number.py create mode 100644 list/tempCodeRunnerFile.py diff --git a/Loops/tempCodeRunnerFile.py b/Loops/tempCodeRunnerFile.py index af35f1b..a8ef623 100644 --- a/Loops/tempCodeRunnerFile.py +++ b/Loops/tempCodeRunnerFile.py @@ -1,2 +1,21 @@ +# program to find out EMI using formula +# EMI = (p*r(1+r)**t)/((1+r)**t-1) +# made by : rakesh kumar - r = int(input('Enter rate of interest amount :')) \ No newline at end of file +from math import pow + + +def emi_calculate(p, r, t): + r = r/(12*100) # rate for one month + t = t*12 # one month time + emi = (p*r*pow(1+r, t))/(pow(1+r, t)-1) + return emi + + +if __name__ == "__main__": + p = int(input('Enter pricipal amount :')) + r = int(input('Enter rate of interest :')) + t = int(input('Enter time in years :')) + emi = emi_calculate(p, r, t) + + print('Monthly Installment :%.2f' % emi) diff --git a/list/shifting_number.py b/list/shifting_number.py new file mode 100644 index 0000000..6b7fb27 --- /dev/null +++ b/list/shifting_number.py @@ -0,0 +1,15 @@ +# program to shift positive number at left hand side and negative number at right hand side. + +list1 = [-2, 1, -3, -15, 16, -17, 5, -3, -6] +list2 = [] +n = len(list1) + +for x in range(n): + if list1[x] > 0: + list2.append(list1[x]) + +for x in range(n-1, -1, -1): + if(list1[x]) < 0: + list2.append(list1[x]) + +print(list2) diff --git a/list/tempCodeRunnerFile.py b/list/tempCodeRunnerFile.py new file mode 100644 index 0000000..fa04cbe --- /dev/null +++ b/list/tempCodeRunnerFile.py @@ -0,0 +1 @@ +[-2, 1, -3, -15, 16, -17, 5, -3, -6] \ No newline at end of file