0% found this document useful (0 votes)
80 views

Python Programs: Assignment 1

This document contains 5 Python programs: 1) to calculate depreciation of a printing press, 2) to predict future values using the time value of money formula, 3) to calculate interest rates, 4) to calculate square roots, and 5) to convert kilometers to miles. The Python code and expected output are provided for each program.

Uploaded by

Vennila G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

Python Programs: Assignment 1

This document contains 5 Python programs: 1) to calculate depreciation of a printing press, 2) to predict future values using the time value of money formula, 3) to calculate interest rates, 4) to calculate square roots, and 5) to convert kilometers to miles. The Python code and expected output are provided for each program.

Uploaded by

Vennila G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

PYTHON PROGRAMS

ASSIGNMENT 1

VENNILA G
20COME052
1. CALCULATE DEPRECIATION USING PYTHON:
ABC company purchases a printing press to print flyers for Rs. 40,000 with a
useful life of 1,80,000 units and residual value of Rs. 4000. It prints 4000
flyers. Calculate per unit and total depreciation using python.
PYTHON CODE:
#Calculate Annual Depreciation and Total Depreciation

AC=40000
RV=4000
N=180000
unit=4000

#Annual Depreciation Expense
Annual_Dep= (AC-RV)/N
print('Annual Depreciation Expense:',round(Annual_Dep,2))

#Total Depreciation Expense
Total_Dep= Annual_Dep*unit
print('Total Depreciation Expenses:',round(Total_Dep,2))

OUTPUT:
2. Predict the future value(TVM)
A. Save Rs. 1000 for one year at an interest rate of 3% p.a
PYTHON CODE:
#Python Program to compute the Future Value
#Present Value, Rate of Interest and a Number of Years
PV= 1000
R= 3
N= 1
#Future Value
future_value= PV*(1+(0.01*R))**N)
print('Future value(FV):',round(future_value,2))

OUTPUT:

B. Save Rs. 1000 for three years at an interest rate of 3% p.a


PYTHON CODE:
#Python Program to compute the Future Value
#Present Value, Rate of Interest and a Number of Years
PV= 1000
R= 3
N= 3
#Future Value
future_value= PV*(1+(0.01*R))**N)
print('Future value(FV):',round(future_value,2))
OUTPUT:

3) Find interest and returns rates using python.


A. Today you receive the offer to deposit doller 90 a saving account
getting back 93.5 doller in one year
PYTHON CODE:
#Find interest
FV=93.5
PV=90
N=3

#interest Formula
R= (FV/PV)*1/N-1
print('Rate of Interest (R):',round(R,2))
OUTPUT:

B. Today you receive the offer to deposit doller 90 a saving account


getting back 93.5 doller in threr years
PYTHON CODE:

#Find interest
FV=93.5
PV=90
N=3

#interest Formula
R= (FV/PV)*1/N-1
print('Rate of Interest (R):',round(R,2))

OUTPUT:
4) Find the square root using python
PYTHON CODE
#Find square Root
import math
number =int(input('enter a new number:'))
sqrt = math.sqrt(number)
print("square root:", sqrt)

Click Run it shows text box. Then you want enter the value which You want to
find square root

Enter: 900 (your choice)

OUTPUT:
5) Python Program to Convert Kilometers to Miles
PYTHON CODE:
#Convert Kilometers to Miles
kilometers = float(input('ENTER VALUE IN KILOMETERS:'))

#conversion factor
conv_fac = 0.621371

#calculate miles
miles = kilometers*conv_fac
print('%0.4f kilometers is equal to %0.4f miles' %(kilometers
,miles))

Click Run it shows text box. Then you want enter the value which You
want to convert into kilometres.

Enter: 40 (your choice)

OUTPUT:

You might also like