Python Programs: Assignment 1
Python Programs: Assignment 1
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:
#interest Formula
R= (FV/PV)*1/N-1
print('Rate of Interest (R):',round(R,2))
OUTPUT:
#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
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.
OUTPUT: