Python Program
Python Program
CODE
OUTPUT
PYTHON PROGRAM
2.Write a program in python to calculate simple interest using a
function interest() that can receive principal amount, time and
rate and returns calculated simple interest. Do specify default
values for rate and time as 10% and 2 years respectively.
CODE
OUTPUT
PYTHON PROGRAM
3.Write a program in python that receives two numbers in a
function and returns the results of all arithmetic operations (+ , -
,* , / , % ) on these numbers.
CODE
OUTPUT
PYTHON PROGRAM
4.Write a program in python that generates 4 terms of an AP by
providing initial and step values to a function that returns first
four terms of the series.
CODE
OUTPUT
PYTHON PROGRAM
5.Write a python program to create a random number generator
that generates random numbers between 1 and 6 (simulates a
dice)
CODE
OUTPUT
PYTHON PROGRAM
6.Write a python program that inputs a real number and converts
it to the nearest integer using two different built-in-functions. It
also displays the given number rounded off to 3 places after
decimal.
CODE
OUTPUT
PYTHON PROGRAM
7.Write a python program that displays the size of a file after
removing EOL characters, leading and trailing white spaces and
blank lines.
FILE NAME
CODE
OUTPUT
PYTHON PROGRAM
8.Write a python program to display the number of lines in the
file.
CODE
OUTPUT
FILE NAME
PYTHON PROGRAM
9.Write a python program to display the size of file in bytes.
FILE SIZE
OUTPUT